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
12 /***
13 * Interface for the class info implementations.
14 *
15 * @author <a href="mailto:jboner@codehaus.org">Jonas Bonér </a>
16 */
17 public interface ClassInfo extends ReflectionInfo {
18 /***
19 * Returns a constructor info by its hash.
20 *
21 * @param hash
22 * @return
23 */
24 ConstructorInfo getConstructor(int hash);
25
26 /***
27 * Returns the constructors info.
28 *
29 * @return the constructors info
30 */
31 ConstructorInfo[] getConstructors();
32
33 /***
34 * Returns a method info by its hash.
35 *
36 * @param hash
37 * @return
38 */
39 MethodInfo getMethod(int hash);
40
41 /***
42 * Returns the methods info.
43 *
44 * @return the methods info
45 */
46 MethodInfo[] getMethods();
47
48 /***
49 * Returns a field info by its hash.
50 *
51 * @param hash
52 * @return
53 */
54 FieldInfo getField(int hash);
55
56 /***
57 * Returns the fields info.
58 *
59 * @return the fields info
60 */
61 FieldInfo[] getFields();
62
63 /***
64 * Returns the interfaces.
65 *
66 * @return the interfaces
67 */
68 ClassInfo[] getInterfaces();
69
70 /***
71 * Returns the super class.
72 *
73 * @return the super class
74 */
75 ClassInfo getSuperClass();
76
77 /***
78 * Returns the component type if array type else null.
79 *
80 * @return the component type
81 */
82 ClassInfo getComponentType();
83
84 /***
85 * Is the class an interface.
86 *
87 * @return
88 */
89 boolean isInterface();
90
91 /***
92 * Is the class a primitive type.
93 *
94 * @return
95 */
96 boolean isPrimitive();
97
98 /***
99 * Is the class an array type.
100 *
101 * @return
102 */
103 boolean isArray();
104
105 public static class NullClassInfo implements ClassInfo {
106
107 public ConstructorInfo getConstructor(int hash) {
108 return null;
109 }
110
111 public ConstructorInfo[] getConstructors() {
112 return new ConstructorInfo[0];
113 }
114
115 public MethodInfo getMethod(int hash) {
116 return null;
117 }
118
119 public MethodInfo[] getMethods() {
120 return new MethodInfo[0];
121 }
122
123 public FieldInfo getField(int hash) {
124 return null;
125 }
126
127 public FieldInfo[] getFields() {
128 return new FieldInfo[0];
129 }
130
131 public ClassInfo[] getInterfaces() {
132 return new ClassInfo[0];
133 }
134
135 public ClassInfo getSuperClass() {
136 return null;
137 }
138
139 public ClassInfo getComponentType() {
140 return null;
141 }
142
143 public boolean isInterface() {
144 return false;
145 }
146
147 public boolean isPrimitive() {
148 return false;
149 }
150
151 public boolean isArray() {
152 return false;
153 }
154
155 public String getName() {
156 return null;
157 }
158
159 public int getModifiers() {
160 return 0;
161 }
162
163 public List getAnnotations() {
164 return null;
165 }
166 }
167 }