|
|||||||||||||||||||
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
XClass.java | - | - | - | - |
|
1 |
/*
|
|
2 |
* Copyright (c) 2001-2003 The XDoclet team
|
|
3 |
* All rights reserved.
|
|
4 |
*/
|
|
5 |
package xjavadoc;
|
|
6 |
|
|
7 |
import org.apache.commons.collections.Predicate;
|
|
8 |
|
|
9 |
import java.util.List;
|
|
10 |
import java.io.File;
|
|
11 |
import java.io.IOException;
|
|
12 |
|
|
13 |
/**
|
|
14 |
* This class represents any type: source class, binary class or primitive type.
|
|
15 |
*
|
|
16 |
* @author Aslak Hellesøy
|
|
17 |
* @created 7. mars 2003
|
|
18 |
*/
|
|
19 |
public interface XClass extends XType |
|
20 |
{ |
|
21 |
/**
|
|
22 |
* Returns true if this is an inner class.
|
|
23 |
*
|
|
24 |
* @return true if this is an inner class.
|
|
25 |
*/
|
|
26 |
public boolean isInner(); |
|
27 |
|
|
28 |
/**
|
|
29 |
* Returns the containing class, if this is an inner class.
|
|
30 |
*
|
|
31 |
* @return the containing class.
|
|
32 |
*/
|
|
33 |
public XClass getContainingClass();
|
|
34 |
|
|
35 |
/**
|
|
36 |
* Returns true if this class is a primitive. That is, one of the following:
|
|
37 |
*
|
|
38 |
* <ul>
|
|
39 |
* <li> boolean</li>
|
|
40 |
* <li> byte</li>
|
|
41 |
* <li> char</li>
|
|
42 |
* <li> double</li>
|
|
43 |
* <li> float</li>
|
|
44 |
* <li> int</li>
|
|
45 |
* <li> long</li>
|
|
46 |
* <li> short</li>
|
|
47 |
* <li> java.lang.Boolean</li>
|
|
48 |
* <li> java.lang.Byte</li>
|
|
49 |
* <li> java.lang.Character</li>
|
|
50 |
* <li> java.lang.Double</li>
|
|
51 |
* <li> java.lang.Float</li>
|
|
52 |
* <li> java.lang.Integer</li>
|
|
53 |
* <li> java.lang.Long</li>
|
|
54 |
* <li> java.lang.Short</li>
|
|
55 |
* <li> java.lang.String</li>
|
|
56 |
* </ul>
|
|
57 |
*
|
|
58 |
*
|
|
59 |
* @return true if a primitive
|
|
60 |
*/
|
|
61 |
public boolean isPrimitive(); |
|
62 |
|
|
63 |
/**
|
|
64 |
* Returns true if this class is anonymous.
|
|
65 |
*
|
|
66 |
* @return true if this class is anonymous.
|
|
67 |
*/
|
|
68 |
public boolean isAnonymous(); |
|
69 |
|
|
70 |
/**
|
|
71 |
* Gets the qualified class name.
|
|
72 |
*
|
|
73 |
* @return the qualified class name.
|
|
74 |
*/
|
|
75 |
String getQualifiedName(); |
|
76 |
|
|
77 |
/**
|
|
78 |
* Gets the transformed class name, for example: <code>Character$Subset</code>
|
|
79 |
*
|
|
80 |
* @return the transformed class name.
|
|
81 |
*/
|
|
82 |
String getTransformedName(); |
|
83 |
|
|
84 |
/**
|
|
85 |
* Gets the transformed qualified class name, for example: <code>java.lang.Character$Subset</code>
|
|
86 |
*
|
|
87 |
* @return the transformed qualified class name.
|
|
88 |
*/
|
|
89 |
String getTransformedQualifiedName(); |
|
90 |
|
|
91 |
/**
|
|
92 |
* Gets the type, e.g. <code>java.lang.String.class</code> or <code>java.lang.Integer.TYPE</code>
|
|
93 |
* .
|
|
94 |
*
|
|
95 |
* @return the qualified class name.
|
|
96 |
*/
|
|
97 |
String getType(); |
|
98 |
|
|
99 |
/**
|
|
100 |
* Gets the constructor with the given signature.
|
|
101 |
*
|
|
102 |
* @param constructorNameWithSignature the signature of the constructor, e.g.
|
|
103 |
* <code>Foo(int,java.lang.String)>/code>.
|
|
104 |
*
|
|
105 |
*
|
|
106 |
*
|
|
107 |
*
|
|
108 |
*
|
|
109 |
* @return the constructor.
|
|
110 |
*/
|
|
111 |
XConstructor getConstructor( String constructorNameWithSignature ); |
|
112 |
|
|
113 |
XField getField( String name ); |
|
114 |
|
|
115 |
boolean isAbstract();
|
|
116 |
|
|
117 |
/**
|
|
118 |
* Returns true if we are subclass or implement the class/interface with the
|
|
119 |
* name classOrInterfaceName
|
|
120 |
*
|
|
121 |
* @param full_qualified_type_name The full qualified type name
|
|
122 |
* @return true if of the specified type; false
|
|
123 |
* otherwise
|
|
124 |
*/
|
|
125 |
boolean isA( String full_qualified_type_name );
|
|
126 |
|
|
127 |
/**
|
|
128 |
* Returns true if we are subclass or implement the class/interface with the
|
|
129 |
* name classOrInterfaceName
|
|
130 |
*
|
|
131 |
* @param full_qualified_type_name The full qualified type name
|
|
132 |
* @param superclases whether the isA search should search the
|
|
133 |
* whole hierarchy
|
|
134 |
* @return true if of the specified type; false
|
|
135 |
* otherwise
|
|
136 |
*/
|
|
137 |
boolean isA( String full_qualified_type_name, boolean superclases ); |
|
138 |
|
|
139 |
/**
|
|
140 |
* Return superclass of this class. If this class represents an interface, null
|
|
141 |
* will be returned.
|
|
142 |
*
|
|
143 |
* @return superclass of this class
|
|
144 |
*/
|
|
145 |
XClass getSuperclass(); |
|
146 |
|
|
147 |
/**
|
|
148 |
* Returns the (known) direct subclasses. If this instance represents an
|
|
149 |
* interface, UnsupportedOperationException will be thrown. This can be avoided
|
|
150 |
* by testing with isInterface() prior to calling this method.
|
|
151 |
*
|
|
152 |
* @return the (known) subclasses
|
|
153 |
*/
|
|
154 |
List getDirectSubclasses(); |
|
155 |
|
|
156 |
/**
|
|
157 |
* Returns the (known) subclasses, regardless of how deep in the class
|
|
158 |
* hierarchy. If this instance represents an interface,
|
|
159 |
* UnsupportedOperationException will be thrown. This can be avoided by testing
|
|
160 |
* with isInterface() prior to calling this method.
|
|
161 |
*
|
|
162 |
* @return the (known) subclasses
|
|
163 |
*/
|
|
164 |
List getAllSubclasses(); |
|
165 |
|
|
166 |
/**
|
|
167 |
* Return the (known) classes that implement this interface. If this instance
|
|
168 |
* represents a class, an UnsupportedOperationException will be thrown. This
|
|
169 |
* can be avoided by testing with isInterface() prior to calling this method.
|
|
170 |
*
|
|
171 |
* @return the (known) subinterfaces
|
|
172 |
*/
|
|
173 |
List getImplementingClasses(); |
|
174 |
|
|
175 |
/**
|
|
176 |
* Return the (known) interfaces that extend this interface. If this instance
|
|
177 |
* represents a class, an UnsupportedOperationException will be thrown. This
|
|
178 |
* can be avoided by testing with isInterface() prior to calling this method.
|
|
179 |
*
|
|
180 |
* @return the (known) extending interfaces
|
|
181 |
*/
|
|
182 |
List getExtendingInterfaces(); |
|
183 |
|
|
184 |
/**
|
|
185 |
* Returns all the interfaces implemented by this class. If this class
|
|
186 |
* represents an interface, it will return all the interfaces that this
|
|
187 |
* interface extends.
|
|
188 |
*
|
|
189 |
* @return a Collection of {@link XClass}.
|
|
190 |
*/
|
|
191 |
List getInterfaces(); |
|
192 |
|
|
193 |
/**
|
|
194 |
* Returns an XMethod with the given name and parameters. Example:
|
|
195 |
* getMethod("hello",new String[]{"java.lang.String","int"});
|
|
196 |
*
|
|
197 |
* @param methodNameWithSignature Describe what the parameter does
|
|
198 |
* @param superclasses Looks in superclasses too if true
|
|
199 |
* @return The XMethod if found, otherwise null
|
|
200 |
*/
|
|
201 |
XMethod getMethod( String methodNameWithSignature, boolean superclasses );
|
|
202 |
|
|
203 |
/**
|
|
204 |
* @param methodNameWithSignature
|
|
205 |
* @return The XMethod if found, otherwise null
|
|
206 |
*/
|
|
207 |
XMethod getMethod( String methodNameWithSignature ); |
|
208 |
|
|
209 |
String save( File rootDir ) throws IOException;
|
|
210 |
|
|
211 |
/**
|
|
212 |
* Returns the package this class lives in.
|
|
213 |
*
|
|
214 |
* @return the package this class lives in.
|
|
215 |
*/
|
|
216 |
XPackage getContainingPackage(); |
|
217 |
|
|
218 |
/**
|
|
219 |
* Returns the imported classes.
|
|
220 |
*
|
|
221 |
* @return a Collection of {@link XClass}.
|
|
222 |
*/
|
|
223 |
List getImportedClasses(); |
|
224 |
|
|
225 |
/**
|
|
226 |
* Returns the inner classes.
|
|
227 |
*
|
|
228 |
* @return a Collection of {@link XClass}.
|
|
229 |
*/
|
|
230 |
List getInnerClasses(); |
|
231 |
|
|
232 |
/**
|
|
233 |
* Returns all the methods.
|
|
234 |
*
|
|
235 |
* @param superclasses if true, include methods from superclasses and
|
|
236 |
* interfaces too.
|
|
237 |
* @return A collection of XMethod objects
|
|
238 |
*/
|
|
239 |
List getMethods( boolean superclasses );
|
|
240 |
|
|
241 |
/**
|
|
242 |
* Returns all the methods that are accepted by the filter.
|
|
243 |
*
|
|
244 |
* @param superclasses if true, include methods from superclasses too.
|
|
245 |
* @param predicate
|
|
246 |
* @return A collection of XMethod objects
|
|
247 |
*/
|
|
248 |
List getMethods( Predicate predicate, boolean superclasses );
|
|
249 |
|
|
250 |
/**
|
|
251 |
* Returns all the methods, not including superclasses
|
|
252 |
*
|
|
253 |
* @return A collection of XMethod objects
|
|
254 |
*/
|
|
255 |
List getMethods(); |
|
256 |
|
|
257 |
List getFields(); |
|
258 |
|
|
259 |
List getFields( boolean superclasses );
|
|
260 |
|
|
261 |
List getConstructors(); |
|
262 |
|
|
263 |
List getImportedPackages(); |
|
264 |
|
|
265 |
/**
|
|
266 |
* Returns true if the superclass (or recursively superclass of superclass) is
|
|
267 |
* full_qualified_type_name.
|
|
268 |
*
|
|
269 |
* @param full_qualified_type_name Describe what the parameter does
|
|
270 |
* @return Describe the return value
|
|
271 |
*/
|
|
272 |
boolean isSubclassOf( String full_qualified_type_name );
|
|
273 |
|
|
274 |
/**
|
|
275 |
* Returns true if the superclass (or recursively superclass of superclass, if
|
|
276 |
* superclasses==true) is full_qualified_type_name.
|
|
277 |
*
|
|
278 |
* @param full_qualified_type_name Describe what the parameter does
|
|
279 |
* @param superclasses Looks in superclasses too if true
|
|
280 |
* @return Describe the return value
|
|
281 |
*/
|
|
282 |
boolean isSubclassOf( String full_qualified_type_name, boolean superclasses ); |
|
283 |
|
|
284 |
/**
|
|
285 |
* Returns true if it implements full_qualified_type_name (or recursively
|
|
286 |
* superclasses implement).
|
|
287 |
*
|
|
288 |
* @param full_qualified_type_name Describe what the parameter does
|
|
289 |
* @return Describe the return value
|
|
290 |
*/
|
|
291 |
boolean isImplementingInterface( String full_qualified_type_name );
|
|
292 |
|
|
293 |
/**
|
|
294 |
* Returns true if it implements full_qualified_type_name (or recursively
|
|
295 |
* superclasses implement, if superclasses==true).
|
|
296 |
*
|
|
297 |
* @param full_qualified_type_name Describe what the parameter does
|
|
298 |
* @param superclasses Looks in superclasses too if true
|
|
299 |
* @return Describe the return value
|
|
300 |
*/
|
|
301 |
boolean isImplementingInterface( String full_qualified_type_name, boolean superclasses ); |
|
302 |
|
|
303 |
/**
|
|
304 |
* Returns true if this instance can be saved.
|
|
305 |
*
|
|
306 |
* @return The Writeable value
|
|
307 |
*/
|
|
308 |
boolean isWriteable();
|
|
309 |
|
|
310 |
/**
|
|
311 |
* mark this class dirty for saving
|
|
312 |
*/
|
|
313 |
void setDirty();
|
|
314 |
|
|
315 |
/**
|
|
316 |
* whether class needs saving
|
|
317 |
*
|
|
318 |
* @return true if save needed
|
|
319 |
*/
|
|
320 |
boolean saveNeeded();
|
|
321 |
|
|
322 |
/**
|
|
323 |
* @return the time that this class was last modified
|
|
324 |
*/
|
|
325 |
long lastModified();
|
|
326 |
|
|
327 |
boolean isInterface();
|
|
328 |
|
|
329 |
/**
|
|
330 |
* Returns a collection of tags from the methods in this class (or
|
|
331 |
* superclasses).
|
|
332 |
*
|
|
333 |
* @param superclasses
|
|
334 |
* @param tagName
|
|
335 |
* @return a List of {@link XTag}. If no tags are found, an empty
|
|
336 |
* List is returned.
|
|
337 |
*/
|
|
338 |
List getMethodTags( String tagName, boolean superclasses );
|
|
339 |
|
|
340 |
XClass qualify( String unqualifiedClassName ); |
|
341 |
} |
|
342 |
|
|