KickJava   Java API By Example, From Geeks To Geeks.

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


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

9 public class FieldAccessFilter extends AbstractFilter<CtFieldAccess<?>> {
10     CtFieldReference<?> field;
11
12     /**
13      * Creates a new field access filter.
14      * @param field the accessed field
15      */

16     public FieldAccessFilter(CtFieldReference<?> field) {
17         super(CtFieldAccess.class);
18         this.field = field;
19     }
20
21     public boolean matches(CtFieldAccess<?> fieldAccess) {
22         return fieldAccess.getVariable().equals(field);
23     }
24 }
Popular Tags