1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
package org.apache.commons.classscan.builtin; |
15 | |
|
16 | |
import java.util.Collections; |
17 | |
import java.util.Set; |
18 | |
|
19 | |
import org.apache.commons.classscan.MetaClassPathElement; |
20 | |
import org.apache.commons.classscan.model.MetaAnnotation; |
21 | |
import org.apache.commons.classscan.model.MetaClass; |
22 | |
import org.apache.commons.classscan.model.MetaField; |
23 | |
import org.apache.commons.classscan.model.MetaMethod; |
24 | |
import org.apache.commons.classscan.spi.model.SpiMetaClass; |
25 | |
import org.apache.commons.classscan.spi.model.SpiMetaClassLoader; |
26 | |
|
27 | 0 | public enum PrimitiveClass implements SpiMetaClass { |
28 | |
|
29 | 0 | B(Byte.TYPE, Byte.class), |
30 | 0 | C(Character.TYPE, Character.class), |
31 | 0 | D(Double.TYPE, Double.class), |
32 | 0 | F(Float.TYPE, Float.class), |
33 | 0 | I(Integer.TYPE, Integer.class), |
34 | 0 | J(Long.TYPE, Long.class), |
35 | 0 | S(Short.TYPE, Short.class), |
36 | 0 | Z(Boolean.TYPE, Boolean.class), |
37 | 0 | V(Void.TYPE, Void.class); |
38 | |
|
39 | |
private final String primitiveName; |
40 | |
private final String wrapperName; |
41 | |
|
42 | 0 | PrimitiveClass(Class<?> typeClass, Class<?> wrapperClass) { |
43 | 0 | primitiveName= typeClass.getCanonicalName(); |
44 | 0 | wrapperName= wrapperClass.getCanonicalName(); |
45 | 0 | } |
46 | |
|
47 | |
@Override |
48 | |
public MetaClassPathElement getClassLocation() { |
49 | 0 | return null; |
50 | |
} |
51 | |
|
52 | |
@Override |
53 | |
public String getName() { |
54 | 0 | return primitiveName; |
55 | |
} |
56 | |
|
57 | |
@Override |
58 | |
public MetaClass getParent() { |
59 | 0 | return null; |
60 | |
} |
61 | |
|
62 | |
@Override |
63 | |
public Set<MetaClass> getInterfaces() { |
64 | 0 | return Collections.emptySet(); |
65 | |
} |
66 | |
|
67 | |
@Override |
68 | |
public Set<? extends MetaAnnotation> getAnnotations() { |
69 | 0 | return Collections.emptySet(); |
70 | |
} |
71 | |
|
72 | |
@Override |
73 | |
public MetaAnnotation getAnnotation(String annotationName) { |
74 | 0 | return null; |
75 | |
} |
76 | |
|
77 | |
@Override |
78 | |
public Set<MetaMethod> getMethods() { |
79 | 0 | return Collections.emptySet(); |
80 | |
} |
81 | |
|
82 | |
@Override |
83 | |
public Set<MetaField> getFields() { |
84 | 0 | return Collections.emptySet(); |
85 | |
} |
86 | |
|
87 | |
@Override |
88 | |
public boolean isAssignableFrom(MetaClass assignor) { |
89 | 0 | return equals(assignor) || assignor.getName().equals(wrapperName); |
90 | |
} |
91 | |
|
92 | |
@Override |
93 | |
public boolean resolve(SpiMetaClassLoader classLoader) { |
94 | 0 | return true; |
95 | |
} |
96 | |
} |