1
2
3
4
5
6
7
8 package it.imolinfo.jbi4corba.webservice.generator.bcm;
9
10 import java.util.ArrayList;
11 import java.util.List;
12
13 import it.imolinfo.jbi4corba.Logger;
14 import it.imolinfo.jbi4corba.LoggerFactory;
15
16 import org.objectweb.asm.AnnotationVisitor;
17 import org.objectweb.asm.commons.EmptyVisitor;
18
19
20
21
22 public class AnnotationCollectorVisitor extends EmptyVisitor {
23
24
25
26
27 private static final Logger LOG = LoggerFactory.getLogger(
28 AnnotationCollectorVisitor.class);
29
30
31
32
33
34 public List<AnnotationValue> list = new ArrayList<AnnotationValue>();
35
36
37
38
39 public AnnotationCollectorVisitor (){
40 }
41
42
43
44
45
46 @Override
47 public void visit(String name, Object value) {
48 LOG.debug("AnnotationCollectorVisitor.visit(String, Object)."
49 + "name=" + name + "; value=" + value);
50
51 AnnotationValue av = new AnnotationValue(AnnotationValue.ANNOTATION_VISIT);
52
53 av.name = name;
54 av.value = value;
55
56 list.add(av);
57
58 super.visit(name, value);
59 }
60
61
62
63
64
65
66 @Override
67 public AnnotationVisitor visitAnnotation(String name, String desc) {
68 LOG.debug("AnnotationCollectorVisitor.visitAnnotation(String, String)."
69 + "name=" + name + "; desc=" + desc);
70
71 AnnotationValue av = new AnnotationValue(
72 AnnotationValue.ANNOTATION_VISIT_ANNOTATION);
73
74 av.name = name;
75 av.desc = desc;
76
77 list.add(av);
78
79 AnnotationCollectorVisitor annotationCollectorVisitor
80 = new AnnotationCollectorVisitor();
81
82 av.nestedAnnotationValue = annotationCollectorVisitor.list;
83 LOG.debug("AnnotationValue." + av);
84
85 return annotationCollectorVisitor;
86 }
87
88
89
90
91
92 @Override
93 public AnnotationVisitor visitArray(String name) {
94 LOG.debug("AnnotationCollectorVisitor.visitArray(String)."
95 + "name=" + name);
96
97 AnnotationValue av = new AnnotationValue(
98 AnnotationValue.ANNOTATION_VISIT_ARRAY);
99
100 av.name = name;
101
102 list.add(av);
103
104 AnnotationCollectorVisitor annotationCollectorVisitor
105 = new AnnotationCollectorVisitor();
106
107 av.nestedAnnotationValue = annotationCollectorVisitor.list;
108 LOG.debug("AnnotationValue." + av);
109
110 return annotationCollectorVisitor;
111 }
112
113
114
115
116
117
118 @Override
119 public void visitEnum(String name, String desc, String value) {
120 LOG.debug("AnnotationCollectorVisitor.visitEnum(String,String,String)."
121 + "name=" + name + "; desc=" + desc + "; value=" + value);
122
123 AnnotationValue av = new AnnotationValue(
124 AnnotationValue.ANNOTATION_VISIT_ENUM);
125
126 av.name = name;
127 av.desc = desc;
128 av.value = value;
129
130 list.add(av);
131
132 super.visitEnum(name, desc, value);
133 }
134
135 }