1 package spoon.support.query; 2 3 import java.lang.annotation.Annotation ; 4 5 import spoon.reflect.declaration.CtElement; 6 7 10 public class AnnotationFilter<E extends CtElement> extends AbstractFilter<E> { 11 Class <? extends Annotation > annotationType; 12 13 public AnnotationFilter(Class <? extends Annotation > annotationType){ 14 super(CtElement.class); 15 this.annotationType=annotationType; 16 } 17 18 21 public AnnotationFilter(Class <E> elementType,Class <? extends Annotation > annotationType) { 22 super(elementType); 23 this.annotationType=annotationType; 24 } 25 26 public boolean matches(E element) { 27 return element.getAnnotation(annotationType)!=null; 28 } 29 } | Popular Tags |