Doclet API

com.sun.javadoc
Interface ClassDoc

All Superinterfaces:
Comparable, Doc, ProgramElementDoc, Type

public interface ClassDoc
extends ProgramElementDoc, Type

Represents a java class and provides access to information about the class, the class' comment and tags, and the members of the class. A ClassDoc only exists if it was processed in this run of javadoc. References to classes which may or may not have been processed in this run are referred to using Type (which can be converted to ClassDoc, if possible).

Since:
JDK1.2
See Also:
Type

Method Summary
 ConstructorDoc[] constructors()
          Return constructors in class.
 boolean definesSerializableFields()
          Return true if Serializable fields are explicitly defined with the special class member serialPersistentFields.
 FieldDoc[] fields()
          Return fields in class.
 ClassDoc findClass(String className)
          Find a class within the context of this class.
 ClassDoc[] importedClasses()
          Get the list of classes declared as imported.
 PackageDoc[] importedPackages()
          Get the list of packages declared as imported.
 ClassDoc[] innerClasses()
          Return inner classes within this class.
 ClassDoc[] interfaces()
          Return interfaces implemented by this class or interfaces extended by this interface.
 boolean isAbstract()
          Return true if this class is abstract
 boolean isExternalizable()
          Return true if this class implements java.io.Externalizable.
 boolean isSerializable()
          Return true if this class implements java.io.Serializable.
 MethodDoc[] methods()
          Return methods in class.
 FieldDoc[] serializableFields()
          Return the Serializable fields of class.
 MethodDoc[] serializationMethods()
          Return the serialization methods for this class.
 boolean subclassOf(ClassDoc cd)
          Test whether this class is a subclass of the specified class.
 ClassDoc superclass()
          Return the superclass of this class
 
Methods inherited from interface com.sun.javadoc.ProgramElementDoc
containingClass, containingPackage, isFinal, isPackagePrivate, isPrivate, isProtected, isPublic, isStatic, modifiers, modifierSpecifier, qualifiedName
 
Methods inherited from interface com.sun.javadoc.Doc
commentText, compareTo, firstSentenceTags, getRawCommentText, inlineTags, isClass, isConstructor, isError, isException, isField, isIncluded, isInterface, isMethod, isOrdinaryClass, name, position, seeTags, setRawCommentText, tags, tags
 
Methods inherited from interface com.sun.javadoc.Type
asClassDoc, dimension, qualifiedTypeName, toString, typeName
 

Method Detail

isAbstract

public boolean isAbstract()
Return true if this class is abstract


isSerializable

public boolean isSerializable()
Return true if this class implements java.io.Serializable. Since java.io.Externalizable extends java.io.Serializable, Externalizable objects are also Serializable.


isExternalizable

public boolean isExternalizable()
Return true if this class implements java.io.Externalizable.


serializationMethods

public MethodDoc[] serializationMethods()
Return the serialization methods for this class.

Returns:
an array of MethodDoc that represents the serialization methods for this class.

serializableFields

public FieldDoc[] serializableFields()
Return the Serializable fields of class.

Return either a list of default fields documented by serial tag
or return a single FieldDoc for serialPersistentField member. There should be a serialField tag for each Serializable field defined by an ObjectStreamField array component of serialPersistentField.

Returns:
an array of FieldDoc for the Serializable fields of this class.
See Also:
definesSerializableFields(), SerialFieldTag

definesSerializableFields

public boolean definesSerializableFields()
Return true if Serializable fields are explicitly defined with the special class member serialPersistentFields.

See Also:
serializableFields(), SerialFieldTag

superclass

public ClassDoc superclass()
Return the superclass of this class

Returns:
the ClassDoc for the superclass of this class, null if there is no superclass.

subclassOf

public boolean subclassOf(ClassDoc cd)
Test whether this class is a subclass of the specified class.

Parameters:
cd - the candidate superclass.
Returns:
true if cd is a superclass of this class.

interfaces

public ClassDoc[] interfaces()
Return interfaces implemented by this class or interfaces extended by this interface. Includes only directly declared interfaces, not inherited interfaces.

Returns:
An array of ClassDoc representing the interfaces. Return an empty array if there are no interfaces.

fields

public FieldDoc[] fields()
Return fields in class.

Returns:
an array of FieldDoc for representing the visible fields in this class.

methods

public MethodDoc[] methods()
Return methods in class.

Returns:
an array of MethodDoc for representing the visible methods in this class. Does not include constructors.

constructors

public ConstructorDoc[] constructors()
Return constructors in class. An array containing the default no-arg constructor is returned if no other constructors exist.

Returns:
an array of ConstructorDoc for representing the visible constructors in this class.

innerClasses

public ClassDoc[] innerClasses()
Return inner classes within this class.

Returns:
an array of ClassDoc for representing the visible classes defined in this class. Anonymous and local classes are not included.

findClass

public ClassDoc findClass(String className)
Find a class within the context of this class. Search order: qualified name, in this class (inner), in this package, in the class imports, in the package imports. Return the ClassDoc if found, null if not found.


importedClasses

public ClassDoc[] importedClasses()
Get the list of classes declared as imported. These are called "single-type-import declarations" in the JLS.

Returns:
an array of ClassDoc representing the imported classes.

importedPackages

public PackageDoc[] importedPackages()
Get the list of packages declared as imported. These are called "type-import-on-demand declarations" in the JLS.

Returns:
an array of PackageDoc representing the imported packages.

Doclet API

Submit a bug or feature
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-2002 Sun Microsystems, Inc. 901 San Antonio Road
Palo Alto, California, 94303, U.S.A. All Rights Reserved.