1
2
3
4
5
6
7
8 package it.imolinfo.jbi4corba.webservice.generator.bcm;
9
10 import it.imolinfo.jbi4corba.Logger;
11 import it.imolinfo.jbi4corba.LoggerFactory;
12
13 import java.util.HashMap;
14 import java.util.Map;
15
16 import org.objectweb.asm.AnnotationVisitor;
17 import org.objectweb.asm.commons.EmptyVisitor;
18
19
20
21
22 public class AnnotationCollectorMethodVisitor extends EmptyVisitor {
23
24
25
26
27 private static final Logger LOG
28 = LoggerFactory.getLogger(AnnotationCollectorMethodVisitor.class);
29
30 protected String methodName = null;
31 protected AnnotationsMaps tracer;
32
33
34
35
36
37
38
39 public AnnotationCollectorMethodVisitor(AnnotationsMaps tracer,
40 String methodName) {
41
42 super();
43
44 this.methodName = methodName;
45 this.tracer = (tracer == null) ? new AnnotationsMaps() : tracer;
46 }
47
48
49
50
51
52
53
54 @Override
55 public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
56 LOG.info("CRB000602_ANNOTATION", new Object[]{desc, visible});
57
58 AnnotationCollectorVisitor visitor
59 = new AnnotationCollectorVisitor();
60
61 AnnotationCollectorVisitor av = (AnnotationCollectorVisitor)
62 visitor.visitAnnotation(desc, visible);
63
64 AnnotationVisibleAndValue avv
65 = new AnnotationVisibleAndValue(visible, av.list);
66
67 if (tracer.annotationOnMethod.get(methodName) == null) {
68 Map<String, AnnotationVisibleAndValue> annotations
69 = new HashMap<String, AnnotationVisibleAndValue>();
70
71 tracer.annotationOnMethod.put(methodName, annotations);
72 }
73 tracer.annotationOnMethod.get(methodName).put(desc, avv);
74
75 return av;
76 }
77
78 }