1 package org.objectweb.celtix.common.annotation; 2 3 import java.lang.annotation.Annotation ; 4 import java.lang.reflect.Field ; 5 import java.lang.reflect.Method ; 6 import java.util.ArrayList ; 7 import java.util.List ; 8 9 public abstract class AbstractAnnotationVisitor implements AnnotationVisitor { 10 11 private final List <Class <? extends Annotation >> targetAnnotations = 12 new ArrayList <Class <? extends Annotation >>(); 13 14 private Object target; 15 16 protected AbstractAnnotationVisitor(Class <? extends Annotation > ann) { 17 addTargetAnnotation(ann); 18 } 19 20 protected final void addTargetAnnotation(Class <? extends Annotation > ann) { 21 targetAnnotations.add(ann); 22 } 23 24 public void visitClass(Class <?> clz, Annotation annotation) { 25 } 27 28 public List <Class <? extends Annotation >> getTargetAnnotations() { 29 return targetAnnotations; 30 } 31 32 public void visitField(Field field, Annotation annotation) { 33 } 35 36 public void visitMethod(Method method, Annotation annotation) { 37 } 39 40 public void setTarget(Object object) { 41 target = object; 42 } 43 44 public Object getTarget() { 45 return target; 46 } 47 48 } 49 | Popular Tags |