1 | |
package org.apache.maven.tools.plugin.annotations.scanner.visitors; |
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
|
20 | |
|
21 | |
|
22 | |
import org.codehaus.plexus.logging.Logger; |
23 | |
import org.objectweb.asm.AnnotationVisitor; |
24 | |
|
25 | |
import java.util.HashMap; |
26 | |
import java.util.Map; |
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
|
32 | |
public class MojoAnnotationVisitor |
33 | |
implements AnnotationVisitor |
34 | |
{ |
35 | |
private Logger logger; |
36 | |
|
37 | |
private String annotationClassName; |
38 | |
|
39 | 6 | private Map<String, Object> annotationValues = new HashMap<String, Object>(); |
40 | |
|
41 | |
MojoAnnotationVisitor( Logger logger, String annotationClassName ) |
42 | 6 | { |
43 | 6 | this.logger = logger; |
44 | 6 | this.annotationClassName = annotationClassName; |
45 | 6 | } |
46 | |
|
47 | |
public Map<String, Object> getAnnotationValues() |
48 | |
{ |
49 | 6 | return annotationValues; |
50 | |
} |
51 | |
|
52 | |
public void visit( String name, Object value ) |
53 | |
{ |
54 | 11 | annotationValues.put( name, value ); |
55 | 11 | logger.debug( "MojoAnnotationVisitor#visit:" + name + ":" + value ); |
56 | 11 | } |
57 | |
|
58 | |
public void visitEnum( String name, String desc, String value ) |
59 | |
{ |
60 | 2 | annotationValues.put( name, value ); |
61 | 2 | logger.debug( "MojoAnnotationVisitor#visitEnum:" + name + ":" + desc + ":" + value ); |
62 | 2 | } |
63 | |
|
64 | |
public AnnotationVisitor visitAnnotation( String name, String desc ) |
65 | |
{ |
66 | 0 | logger.debug( "MojoAnnotationVisitor#visitAnnotation:" + name + ":" + desc ); |
67 | 0 | return new MojoAnnotationVisitor( logger, this.annotationClassName ); |
68 | |
} |
69 | |
|
70 | |
public AnnotationVisitor visitArray( String s ) |
71 | |
{ |
72 | 0 | logger.debug( "MojoAnnotationVisitor#visitArray" ); |
73 | 0 | return new MojoAnnotationVisitor( logger, this.annotationClassName ); |
74 | |
} |
75 | |
|
76 | |
public void visitEnd() |
77 | |
{ |
78 | |
|
79 | 6 | } |
80 | |
|
81 | |
public String getAnnotationClassName() |
82 | |
{ |
83 | 8 | return annotationClassName; |
84 | |
} |
85 | |
} |