1 /***************************************************************************************
2 * Copyright (c) Jonas BonŽr, Alexandre Vasseur. All rights reserved. *
3 * http://aspectwerkz.codehaus.org *
4 * ---------------------------------------------------------------------------------- *
5 * The software in this package is published under the terms of the LGPL license *
6 * a copy of which has been included with this distribution in the license.txt file. *
7 **************************************************************************************/
8 package org.codehaus.aspectwerkz.reflect;
9
10 import java.util.List;
11 import java.util.ArrayList;
12
13 /***
14 * Interface for the class info implementations.
15 *
16 * @author <a href="mailto:jboner@codehaus.org">Jonas BonŽr </a>
17 */
18 public interface ClassInfo extends ReflectionInfo {
19 /***
20 * Returns a constructor info by its hash.
21 * Looks up in the hierarchy
22 *
23 * @param hash
24 * @return
25 */
26 ConstructorInfo getConstructor(int hash);
27
28 /***
29 * Returns the constructors info.
30 * Does not looks up in the hierarchy
31 *
32 * @return the constructors info
33 */
34 ConstructorInfo[] getConstructors();
35
36 /***
37 * Returns a method info by its hash.
38 * Looks up in the hierarchy
39 *
40 * @param hash
41 * @return
42 */
43 MethodInfo getMethod(int hash);
44
45 /***
46 * Returns the methods info.
47 * Does not looks up in the hierarchy
48 *
49 * @return the methods info
50 */
51 MethodInfo[] getMethods();
52
53 /***
54 * Returns a field info by its hash.
55 * Looks up in the hierarchy
56 *
57 * @param hash
58 * @return
59 */
60 FieldInfo getField(int hash);
61
62 /***
63 * Returns the fields info.
64 * Does not looks up in the hierarchy
65 *
66 * @return the fields info
67 */
68 FieldInfo[] getFields();
69
70 /***
71 * Returns the class loader that loaded this class.
72 *
73 * @return the class loader
74 */
75 ClassLoader getClassLoader();
76
77 /***
78 * Checks if the class has a static initalizer.
79 *
80 * @return
81 */
82 boolean hasStaticInitializer();
83
84 /***
85 * Returns the static initializer info of the current underlying class if any.
86 *
87 * @return
88 */
89 StaticInitializationInfo staticInitializer();
90
91 /***
92 * Returns the interfaces.
93 *
94 * @return the interfaces
95 */
96 ClassInfo[] getInterfaces();
97
98 /***
99 * Returns the super class, or null (superclass of java.lang.Object)
100 *
101 * @return the super class
102 */
103 ClassInfo getSuperclass();
104
105 /***
106 * Returns the component type if array type else null.
107 *
108 * @return the component type
109 */
110 ClassInfo getComponentType();
111
112 /***
113 * Is the class an interface.
114 *
115 * @return
116 */
117 boolean isInterface();
118
119 /***
120 * Is the class a primitive type.
121 *
122 * @return
123 */
124 boolean isPrimitive();
125
126 /***
127 * Is the class an array type.
128 *
129 * @return
130 */
131 boolean isArray();
132
133 public static class NullClassInfo implements ClassInfo {
134
135 public ConstructorInfo getConstructor(int hash) {
136 return null;
137 }
138
139 public ConstructorInfo[] getConstructors() {
140 return new ConstructorInfo[0];
141 }
142
143 public MethodInfo getMethod(int hash) {
144 return null;
145 }
146
147 public MethodInfo[] getMethods() {
148 return new MethodInfo[0];
149 }
150
151 public FieldInfo getField(int hash) {
152 return null;
153 }
154
155 public FieldInfo[] getFields() {
156 return new FieldInfo[0];
157 }
158
159 public boolean hasStaticInitializer() {
160 return false;
161 }
162
163 /***
164 * @see org.codehaus.aspectwerkz.reflect.ClassInfo#staticInitializer()
165 */
166 public StaticInitializationInfo staticInitializer() {
167 return null;
168 }
169
170 public ClassInfo[] getInterfaces() {
171 return new ClassInfo[0];
172 }
173
174 public ClassInfo getSuperclass() {
175 return null;
176 }
177
178 public ClassLoader getClassLoader() {
179 return null;
180 }
181
182 public ClassInfo getComponentType() {
183 return null;
184 }
185
186 public boolean isInterface() {
187 return false;
188 }
189
190 public boolean isPrimitive() {
191 return false;
192 }
193
194 public boolean isArray() {
195 return false;
196 }
197
198 public String getName() {
199 return null;
200 }
201
202 public String getSignature() {
203 return null;
204 }
205
206 public int getModifiers() {
207 return 0;
208 }
209
210 public List getAnnotations() {
211 return new ArrayList();
212 }
213 }
214 }