1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
package org.apache.commons.classscan.bcel; |
15 | |
|
16 | |
import org.apache.bcel.classfile.AnnotationEntry; |
17 | |
import org.apache.commons.classscan.util.NameSet; |
18 | |
|
19 | |
public class AnnotationMap extends NameSet<BcelAnnotation> { |
20 | |
|
21 | 11 | private static AnnotationMap EMPTY_ANNOTATIONS= new AnnotationMap(new AnnotationEntry[0]); |
22 | |
|
23 | |
public static AnnotationMap createAnnotations(AnnotationEntry[] annotationEntries) { |
24 | 5195619 | if(annotationEntries==null || annotationEntries.length==0) { |
25 | 5165248 | return EMPTY_ANNOTATIONS; |
26 | |
} |
27 | 30371 | return new AnnotationMap(annotationEntries); |
28 | |
} |
29 | |
|
30 | |
private AnnotationMap(AnnotationEntry[] entries) { |
31 | 30382 | super(transformEntries(entries)); |
32 | 30382 | } |
33 | |
|
34 | |
static private BcelAnnotation[] transformEntries(AnnotationEntry[] entries) { |
35 | |
|
36 | 30382 | BcelAnnotation[] annotations = new BcelAnnotation[entries.length]; |
37 | 62810 | for(int i = 0; i<entries.length; ++i) { |
38 | 32428 | annotations[i]= new BcelAnnotation(entries[i]); |
39 | |
} |
40 | 30382 | return annotations; |
41 | |
} |
42 | |
} |