001: /*
002: * Create a graphviz graph based on the classes in the specified java
003: * source files.
004: *
005: * (C) Copyright 2002-2005 Diomidis Spinellis
006: *
007: * Permission to use, copy, and distribute this software and its
008: * documentation for any purpose and without fee is hereby granted,
009: * provided that the above copyright notice appear in all copies and that
010: * both that copyright notice and this permission notice appear in
011: * supporting documentation.
012: *
013: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
014: * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
015: * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
016: *
017: * $Id$
018: *
019: */
020:
021: package org.umlgraph.doclet;
022:
023: import com.sun.javadoc.AnnotationDesc;
024: import com.sun.javadoc.AnnotationTypeDoc;
025: import com.sun.javadoc.ClassDoc;
026: import com.sun.javadoc.ConstructorDoc;
027: import com.sun.javadoc.FieldDoc;
028: import com.sun.javadoc.MethodDoc;
029: import com.sun.javadoc.PackageDoc;
030: import com.sun.javadoc.ParamTag;
031: import com.sun.javadoc.ParameterizedType;
032: import com.sun.javadoc.SeeTag;
033: import com.sun.javadoc.SourcePosition;
034: import com.sun.javadoc.Tag;
035: import com.sun.javadoc.Type;
036: import com.sun.javadoc.TypeVariable;
037: import com.sun.javadoc.WildcardType;
038:
039: /**
040: * A ClassDoc wrapper that caches answer to the most common requests performed
041: * by UMLGraph, considerably improving the overall UMLDoc performance (ClassDoc
042: * computes most of the results for more fine grained information at each call).
043: * <p>
044: * Unfortunately this has a side effect, since it breaks the equals() call between
045: * plain ClassDoc instances and WrappedClassDoc ones, so use it with due care.
046: * <p>
047: * In particular, don't provide WrappedClassDoc instances to the standard doclet.
048: * @author wolf
049: *
050: */
051: public class WrappedClassDoc implements ClassDoc {
052: ClassDoc wrapped;
053: String toString;
054: String name;
055: Tag[] tags;
056:
057: public WrappedClassDoc(ClassDoc wrapped) {
058: this .wrapped = wrapped;
059: }
060:
061: public AnnotationDesc[] annotations() {
062: return wrapped.annotations();
063: }
064:
065: public AnnotationTypeDoc asAnnotationTypeDoc() {
066: return wrapped.asAnnotationTypeDoc();
067: }
068:
069: public ClassDoc asClassDoc() {
070: return wrapped.asClassDoc();
071: }
072:
073: public ParameterizedType asParameterizedType() {
074: return wrapped.asParameterizedType();
075: }
076:
077: public TypeVariable asTypeVariable() {
078: return wrapped.asTypeVariable();
079: }
080:
081: public WildcardType asWildcardType() {
082: return wrapped.asWildcardType();
083: }
084:
085: public String commentText() {
086: return wrapped.commentText();
087: }
088:
089: public int compareTo(Object arg0) {
090: if (arg0 instanceof WrappedClassDoc) {
091: WrappedClassDoc other = (WrappedClassDoc) arg0;
092: return wrapped.compareTo(other.wrapped);
093: }
094: return wrapped.compareTo(arg0);
095: }
096:
097: public ConstructorDoc[] constructors() {
098: return wrapped.constructors();
099: }
100:
101: public ConstructorDoc[] constructors(boolean arg0) {
102: return wrapped.constructors(arg0);
103: }
104:
105: public ClassDoc containingClass() {
106: return wrapped.containingClass();
107: }
108:
109: public PackageDoc containingPackage() {
110: return wrapped.containingPackage();
111: }
112:
113: public boolean definesSerializableFields() {
114: return wrapped.definesSerializableFields();
115: }
116:
117: public String dimension() {
118: return wrapped.dimension();
119: }
120:
121: public FieldDoc[] enumConstants() {
122: return wrapped.enumConstants();
123: }
124:
125: public FieldDoc[] fields() {
126: return wrapped.fields();
127: }
128:
129: public FieldDoc[] fields(boolean arg0) {
130: return wrapped.fields(arg0);
131: }
132:
133: public ClassDoc findClass(String arg0) {
134: return wrapped.findClass(arg0);
135: }
136:
137: public Tag[] firstSentenceTags() {
138: return wrapped.firstSentenceTags();
139: }
140:
141: public String getRawCommentText() {
142: return wrapped.getRawCommentText();
143: }
144:
145: /** @deprecated */
146: public @Deprecated
147: ClassDoc[] importedClasses() {
148: return wrapped.importedClasses();
149: }
150:
151: /** @deprecated */
152: public @Deprecated
153: PackageDoc[] importedPackages() {
154: return wrapped.importedPackages();
155: }
156:
157: public Tag[] inlineTags() {
158: return wrapped.inlineTags();
159: }
160:
161: public ClassDoc[] innerClasses() {
162: return wrapped.innerClasses();
163: }
164:
165: public ClassDoc[] innerClasses(boolean arg0) {
166: return wrapped.innerClasses(arg0);
167: }
168:
169: public ClassDoc[] interfaces() {
170: return wrapped.interfaces();
171: }
172:
173: public Type[] interfaceTypes() {
174: return wrapped.interfaceTypes();
175: }
176:
177: public boolean isAbstract() {
178: return wrapped.isAbstract();
179: }
180:
181: public boolean isAnnotationType() {
182: return wrapped.isAnnotationType();
183: }
184:
185: public boolean isAnnotationTypeElement() {
186: return wrapped.isAnnotationTypeElement();
187: }
188:
189: public boolean isClass() {
190: return wrapped.isClass();
191: }
192:
193: public boolean isConstructor() {
194: return wrapped.isConstructor();
195: }
196:
197: public boolean isEnum() {
198: return wrapped.isEnum();
199: }
200:
201: public boolean isEnumConstant() {
202: return wrapped.isEnumConstant();
203: }
204:
205: public boolean isError() {
206: return wrapped.isError();
207: }
208:
209: public boolean isException() {
210: return wrapped.isException();
211: }
212:
213: public boolean isExternalizable() {
214: return wrapped.isExternalizable();
215: }
216:
217: public boolean isField() {
218: return wrapped.isField();
219: }
220:
221: public boolean isFinal() {
222: return wrapped.isFinal();
223: }
224:
225: public boolean isIncluded() {
226: return wrapped.isIncluded();
227: }
228:
229: public boolean isInterface() {
230: return wrapped.isInterface();
231: }
232:
233: public boolean isMethod() {
234: return wrapped.isMethod();
235: }
236:
237: public boolean isOrdinaryClass() {
238: return wrapped.isOrdinaryClass();
239: }
240:
241: public boolean isPackagePrivate() {
242: return wrapped.isPackagePrivate();
243: }
244:
245: public boolean isPrimitive() {
246: return wrapped.isPrimitive();
247: }
248:
249: public boolean isPrivate() {
250: return wrapped.isPrivate();
251: }
252:
253: public boolean isProtected() {
254: return wrapped.isProtected();
255: }
256:
257: public boolean isPublic() {
258: return wrapped.isPublic();
259: }
260:
261: public boolean isSerializable() {
262: return wrapped.isSerializable();
263: }
264:
265: public boolean isStatic() {
266: return wrapped.isStatic();
267: }
268:
269: public MethodDoc[] methods() {
270: return wrapped.methods();
271: }
272:
273: public MethodDoc[] methods(boolean arg0) {
274: return wrapped.methods(arg0);
275: }
276:
277: public String modifiers() {
278: return wrapped.modifiers();
279: }
280:
281: public int modifierSpecifier() {
282: return wrapped.modifierSpecifier();
283: }
284:
285: public String name() {
286: if (name == null)
287: name = wrapped.name();
288: return name;
289: }
290:
291: public SourcePosition position() {
292: return wrapped.position();
293: }
294:
295: public String qualifiedName() {
296: return wrapped.qualifiedName();
297: }
298:
299: public String qualifiedTypeName() {
300: return wrapped.qualifiedTypeName();
301: }
302:
303: public SeeTag[] seeTags() {
304: return wrapped.seeTags();
305: }
306:
307: public FieldDoc[] serializableFields() {
308: return wrapped.serializableFields();
309: }
310:
311: public MethodDoc[] serializationMethods() {
312: return wrapped.serializationMethods();
313: }
314:
315: public void setRawCommentText(String arg0) {
316: wrapped.setRawCommentText(arg0);
317: }
318:
319: public String simpleTypeName() {
320: return wrapped.simpleTypeName();
321: }
322:
323: public boolean subclassOf(ClassDoc arg0) {
324: return wrapped.subclassOf(arg0);
325: }
326:
327: public ClassDoc super class() {
328: return wrapped.super class();
329: }
330:
331: public Type super classType() {
332: return wrapped.super classType();
333: }
334:
335: public Tag[] tags() {
336: if (tags == null)
337: tags = wrapped.tags();
338: return tags;
339: }
340:
341: public Tag[] tags(String arg0) {
342: return wrapped.tags(arg0);
343: }
344:
345: public String toString() {
346: if (toString == null) {
347: toString = wrapped.toString();
348: }
349: return toString;
350: }
351:
352: public String typeName() {
353: return wrapped.typeName();
354: }
355:
356: public TypeVariable[] typeParameters() {
357: return wrapped.typeParameters();
358: }
359:
360: public ParamTag[] typeParamTags() {
361: return wrapped.typeParamTags();
362: }
363:
364: }
|