01: package tide.bytecode.asm;
02:
03: import org.objectweb.asm.AnnotationVisitor;
04:
05: /** A true empty adapter.
06: */
07: public class AnnotationVisitorAd implements AnnotationVisitor {
08: protected boolean debug = false;
09:
10: final public static AnnotationVisitorAd emptyVis = new AnnotationVisitorAd();
11:
12: public AnnotationVisitorAd() {
13: }
14:
15: public void visit(String name, Object value) {
16: if (debug)
17: System.out.println("visit annotation " + name + ": "
18: + value);
19: }
20:
21: /**
22: * Visits an enumeration value of the annotation.
23: *
24: * @param name the value name.
25: * @param desc the class descriptor of the enumeration class.
26: * @param value the actual enumeration value.
27: */
28: public void visitEnum(String name, String desc, String value) {
29: // visit annotation enum value, Ledu/umd/cs/findbugs/annotations/When;: ANYTIME
30: if (debug)
31: System.out.println("visit annotation enum " + name + ", "
32: + desc + ": " + value);
33: }
34:
35: /**
36: * Visits a nested annotation value of the annotation.
37: *
38: * @param name the value name.
39: * @param desc the class descriptor of the nested annotation class.
40: * @return a non null visitor to visit the actual nested annotation value.
41: * <i>The nested annotation value must be fully visited before
42: * calling other methods on this annotation visitor</i>.
43: */
44: public AnnotationVisitor visitAnnotation(String name, String desc) {
45: if (debug)
46: System.out
47: .println("visit annotation " + name + ": " + desc);
48: return emptyVis;
49: }
50:
51: /**
52: * Visits an array value of the annotation. Note that arrays of primitive
53: * types (such as byte, boolean, short, char, int, long, float or double)
54: * can be passed as value to {@link #visit visit}. This is what
55: * {@link ClassReader} does.
56: *
57: * @param name the value name.
58: * @return a non null visitor to visit the actual array value elements. The
59: * 'name' parameters passed to the methods of this visitor are
60: * ignored. <i>All the array values must be visited before calling
61: * other methods on this annotation visitor</i>.
62: */
63: public AnnotationVisitor visitArray(String name) {
64: if (debug)
65: System.out.println("visit array " + name + ": ");
66: return emptyVis;
67: }
68:
69: /**
70: * Visits the end of the annotation.
71: */
72: public void visitEnd() {
73: if (debug)
74: System.out.println("visit annotation end");
75: }
76:
77: }
|