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 AnnotationCollectorFieldVisitor extends EmptyVisitor {
23
24
25
26
27 private static final Logger LOG
28 = LoggerFactory.getLogger(AnnotationCollectorFieldVisitor.class);
29
30
31 protected String fieldName = null;
32
33
34 protected AnnotationsMaps tracer;
35
36
37
38
39
40
41
42 public AnnotationCollectorFieldVisitor(AnnotationsMaps tracer,
43 String fieldName) {
44
45 super();
46
47 this.fieldName = fieldName;
48 this.tracer = (tracer == null) ? new AnnotationsMaps() : tracer;
49 }
50
51
52
53
54
55
56 @Override
57 public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
58 LOG.info("CRB000602_ANNOTATION", new Object[]{desc, visible});
59
60 AnnotationCollectorVisitor visitor
61 = new AnnotationCollectorVisitor();
62
63 AnnotationCollectorVisitor av = (AnnotationCollectorVisitor)
64 visitor.visitAnnotation(desc, visible);
65
66 AnnotationVisibleAndValue avv
67 = new AnnotationVisibleAndValue(visible, av.list);
68
69 if (tracer.annotationOnField.get(fieldName) == null) {
70 Map<String, AnnotationVisibleAndValue> annotations
71 = new HashMap<String, AnnotationVisibleAndValue>();
72
73 tracer.annotationOnField.put(fieldName, annotations);
74 }
75 tracer.annotationOnField.get(fieldName).put(desc, avv);
76
77 return av;
78 }
79
80 }