001: /**************************************************************************************
002: * Copyright (c) Jonas BonŽr, Alexandre Vasseur. All rights reserved. *
003: * http://aspectwerkz.codehaus.org *
004: * ---------------------------------------------------------------------------------- *
005: * The software in this package is published under the terms of the LGPL license *
006: * a copy of which has been included with this distribution in the license.txt file. *
007: **************************************************************************************/package org.codehaus.aspectwerkz.reflect;
008:
009: import java.util.List;
010: import java.util.ArrayList;
011:
012: /**
013: * Interface for the class info implementations.
014: *
015: * @author <a href="mailto:jboner@codehaus.org">Jonas BonŽr </a>
016: */
017: public interface ClassInfo extends ReflectionInfo {
018: /**
019: * Returns a constructor info by its hash.
020: * Looks up in the hierarchy
021: *
022: * @param hash
023: * @return
024: */
025: ConstructorInfo getConstructor(int hash);
026:
027: /**
028: * Returns the constructors info.
029: * Does not looks up in the hierarchy
030: *
031: * @return the constructors info
032: */
033: ConstructorInfo[] getConstructors();
034:
035: /**
036: * Returns a method info by its hash.
037: * Looks up in the hierarchy
038: *
039: * @param hash
040: * @return
041: */
042: MethodInfo getMethod(int hash);
043:
044: /**
045: * Returns the methods info.
046: * Does not looks up in the hierarchy
047: *
048: * @return the methods info
049: */
050: MethodInfo[] getMethods();
051:
052: /**
053: * Returns a field info by its hash.
054: * Looks up in the hierarchy
055: *
056: * @param hash
057: * @return
058: */
059: FieldInfo getField(int hash);
060:
061: /**
062: * Returns the fields info.
063: * Does not looks up in the hierarchy
064: *
065: * @return the fields info
066: */
067: FieldInfo[] getFields();
068:
069: /**
070: * Returns the class loader that loaded this class.
071: *
072: * @return the class loader
073: */
074: ClassLoader getClassLoader();
075:
076: /**
077: * Checks if the class has a static initalizer.
078: *
079: * @return
080: */
081: boolean hasStaticInitializer();
082:
083: /**
084: * Returns the static initializer info of the current underlying class if any.
085: *
086: * @return
087: */
088: StaticInitializationInfo staticInitializer();
089:
090: /**
091: * Returns the interfaces.
092: *
093: * @return the interfaces
094: */
095: ClassInfo[] getInterfaces();
096:
097: /**
098: * Returns the super class, or null (superclass of java.lang.Object)
099: *
100: * @return the super class
101: */
102: ClassInfo getSuperclass();
103:
104: /**
105: * Returns the component type if array type else null.
106: *
107: * @return the component type
108: */
109: ClassInfo getComponentType();
110:
111: /**
112: * Is the class an interface.
113: *
114: * @return
115: */
116: boolean isInterface();
117:
118: /**
119: * Is the class a primitive type.
120: *
121: * @return
122: */
123: boolean isPrimitive();
124:
125: /**
126: * Is the class an array type.
127: *
128: * @return
129: */
130: boolean isArray();
131:
132: public static class NullClassInfo implements ClassInfo {
133:
134: public ConstructorInfo getConstructor(int hash) {
135: return null; //To change body of implemented methods use File | Settings | File Templates.
136: }
137:
138: public ConstructorInfo[] getConstructors() {
139: return new ConstructorInfo[0]; //To change body of implemented methods use File | Settings | File Templates.
140: }
141:
142: public MethodInfo getMethod(int hash) {
143: return null; //To change body of implemented methods use File | Settings | File Templates.
144: }
145:
146: public MethodInfo[] getMethods() {
147: return new MethodInfo[0]; //To change body of implemented methods use File | Settings | File Templates.
148: }
149:
150: public FieldInfo getField(int hash) {
151: return null; //To change body of implemented methods use File | Settings | File Templates.
152: }
153:
154: public FieldInfo[] getFields() {
155: return new FieldInfo[0]; //To change body of implemented methods use File | Settings | File Templates.
156: }
157:
158: public boolean hasStaticInitializer() {
159: return false;
160: }
161:
162: /**
163: * @see org.codehaus.aspectwerkz.reflect.ClassInfo#staticInitializer()
164: */
165: public StaticInitializationInfo staticInitializer() {
166: return null;
167: }
168:
169: public ClassInfo[] getInterfaces() {
170: return new ClassInfo[0]; //To change body of implemented methods use File | Settings | File Templates.
171: }
172:
173: public ClassInfo getSuperclass() {
174: return null; //To change body of implemented methods use File | Settings | File Templates.
175: }
176:
177: public ClassLoader getClassLoader() {
178: return null;
179: }
180:
181: public ClassInfo getComponentType() {
182: return null; //To change body of implemented methods use File | Settings | File Templates.
183: }
184:
185: public boolean isInterface() {
186: return false; //To change body of implemented methods use File | Settings | File Templates.
187: }
188:
189: public boolean isPrimitive() {
190: return false; //To change body of implemented methods use File | Settings | File Templates.
191: }
192:
193: public boolean isArray() {
194: return false; //To change body of implemented methods use File | Settings | File Templates.
195: }
196:
197: public String getName() {
198: return null; //To change body of implemented methods use File | Settings | File Templates.
199: }
200:
201: public String getSignature() {
202: return null; //To change body of implemented methods use File | Settings | File Templates.
203: }
204:
205: public int getModifiers() {
206: return 0; //To change body of implemented methods use File | Settings | File Templates.
207: }
208:
209: public List getAnnotations() {
210: return new ArrayList();
211: }
212: }
213: }
|