01: package org.objectweb.celtix.common.annotation;
02:
03: import java.lang.annotation.Annotation;
04: import java.lang.reflect.Field;
05: import java.lang.reflect.Method;
06: import java.util.ArrayList;
07: import java.util.List;
08:
09: public abstract class AbstractAnnotationVisitor implements
10: AnnotationVisitor {
11:
12: private final List<Class<? extends Annotation>> targetAnnotations = 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(
21: Class<? extends Annotation> ann) {
22: targetAnnotations.add(ann);
23: }
24:
25: public void visitClass(Class<?> clz, Annotation annotation) {
26: // complete
27: }
28:
29: public List<Class<? extends Annotation>> getTargetAnnotations() {
30: return targetAnnotations;
31: }
32:
33: public void visitField(Field field, Annotation annotation) {
34: // complete
35: }
36:
37: public void visitMethod(Method method, Annotation annotation) {
38: // complete
39: }
40:
41: public void setTarget(Object object) {
42: target = object;
43: }
44:
45: public Object getTarget() {
46: return target;
47: }
48:
49: }
|