1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.jadira.scanner.classpath.types;
17
18 import java.lang.reflect.Array;
19 import java.util.Collections;
20 import java.util.List;
21 import java.util.Set;
22
23 import javassist.bytecode.ClassFile;
24
25 import org.apache.commons.lang3.builder.EqualsBuilder;
26 import org.apache.commons.lang3.builder.HashCodeBuilder;
27 import org.jadira.scanner.classpath.ClasspathResolver;
28 import org.jadira.scanner.core.exception.ClasspathAccessException;
29
30 public class JArrayClass extends JClass {
31
32 private Class<?> actualClass;
33
34 protected JArrayClass(Class<?> clazz, ClasspathResolver resolver) throws ClasspathAccessException {
35 super(JClass.getJClass(Array.class, resolver).getClassFile(), resolver);
36 this.actualClass = clazz;
37 }
38
39 public static JArrayClass getJClass(Class<?> clazz, ClasspathResolver resolver) throws ClasspathAccessException {
40 return new JArrayClass(clazz, resolver);
41 }
42
43 public JClass getSuperClass() throws ClasspathAccessException {
44
45 return null;
46 }
47
48 public List<JInterface> getImplementedInterfaces() throws ClasspathAccessException {
49
50 return Collections.emptyList();
51 }
52
53 @Override
54 public Class<?> getActualClass() throws ClasspathAccessException {
55
56 return this.actualClass;
57 }
58
59 public Set<JClass> getSubClasses() {
60 return Collections.emptySet();
61 }
62
63 public List<JInnerClass> getEnclosedClasses() throws ClasspathAccessException {
64
65 return Collections.emptyList();
66 }
67
68 public List<JField> getFields() {
69
70 return Collections.emptyList();
71 }
72
73 public List<JConstructor> getConstructors() throws ClasspathAccessException {
74
75 return Collections.emptyList();
76 }
77
78 @Override
79 public Set<JAnnotation<?>> getAnnotations() {
80
81 return Collections.emptySet();
82 }
83
84 @Override
85 public JPackage getPackage() throws ClasspathAccessException {
86
87 return null;
88 }
89
90 public List<JMethod> getMethods() {
91
92 return Collections.emptyList();
93 }
94
95 public List<JStaticInitializer> getStaticInitializers() {
96
97 return Collections.emptyList();
98 }
99
100 @Override
101 public boolean isArray() {
102 return true;
103 }
104
105 public String getName() {
106 return actualClass.getName();
107 }
108
109 public ClassFile getClassFile() {
110 return null;
111 }
112
113 @Override
114 public boolean equals(Object obj) {
115 if (obj == null) {
116 return false;
117 }
118 if (obj == this) {
119 return true;
120 }
121 if (obj.getClass() != getClass()) {
122 return false;
123 }
124 JArrayClass rhs = (JArrayClass) obj;
125 return new EqualsBuilder()
126 .appendSuper(super.equals(obj))
127 .append(actualClass, rhs.actualClass).isEquals();
128 }
129
130 @Override
131 public int hashCode() {
132 return new HashCodeBuilder(11, 47).append(super.hashCode())
133 .append(actualClass).toHashCode();
134 }
135 }