KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > spoon > support > query > VariableAccessFilter


1 package spoon.support.query;
2
3 import spoon.reflect.code.CtVariableAccess;
4 import spoon.reflect.reference.CtVariableReference;
5
6 /**
7  * This simple filter matches all the accesses to a given field.
8  */

9 public class VariableAccessFilter extends AbstractFilter<CtVariableAccess<?>> {
10     CtVariableReference<?> variable;
11
12     /**
13      * Creates a new field access filter.
14      *
15      * @param variable
16      * the accessed variable
17      */

18     public VariableAccessFilter(CtVariableReference<?> variable) {
19         super(CtVariableAccess.class);
20         this.variable = variable;
21     }
22
23     public boolean matches(CtVariableAccess<?> variableAccess) {
24         return variableAccess.getVariable().equals(variable);
25     }
26 }
Popular Tags