Doclet API

com.sun.javadoc
Interface ClassDoc

All Superinterfaces:
Comparable, Doc, ProgramElementDoc, Type

public interface ClassDoc
extends ProgramElementDoc, Type

Represents a java class or interface and provides access to information about the class, the class's 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 included constructors in this class.
 ConstructorDoc[] constructors(boolean filter)
          Return constructors in this class, filtered to the specified access modifier option.
 boolean definesSerializableFields()
          Return true if Serializable fields are explicitly defined with the special class member serialPersistentFields.
 FieldDoc[] fields()
          Return included fields in this class or interface.
 FieldDoc[] fields(boolean filter)
          Return fields in this class or interface, filtered to the specified access modifier option
 ClassDoc findClass(String className)
          Find the specified class or interface within the context of this class doc.
 ClassDoc[] importedClasses()
          Get the list of classes and interfaces declared as imported.
 PackageDoc[] importedPackages()
          Get the list of packages declared as imported.
 ClassDoc[] innerClasses()
          Return included nested classes and interfaces within this class or interface.
 ClassDoc[] innerClasses(boolean filter)
          Return nested classes and interfaces within this class or interface filtered to the specified access modifier option.
 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 or interface extends java.io.Externalizable.
 boolean isSerializable()
          Return true if this class implements or interface extends java.io.Serializable.
 MethodDoc[] methods()
          Return included methods in this class or interface.
 MethodDoc[] methods(boolean filter)
          Return methods in this class or interface, filtered to the specified access modifier option.
 FieldDoc[] serializableFields()
          Return the Serializable fields of this class or interface.
 MethodDoc[] serializationMethods()
          Return the serialization methods for this class or interface.
 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. Return true for all interfaces.


isSerializable

public boolean isSerializable()
Return true if this class implements or interface extends 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 or interface extends java.io.Externalizable.


serializationMethods

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

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

serializableFields

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

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 objects for the Serializable fields of this class or interface.
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. Return null is this is an interface.

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. If this is an interface, return false for all classes except java.lang.Object (we must keep this unexpected behavior for compatibility reasons).

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. Return an empty array if there are no interfaces.

Returns:
An array of ClassDoc objects representing the interfaces.

fields

public FieldDoc[] fields()
Return included fields in this class or interface.

Returns:
an array of FieldDoc objects representing the included fields in this class or interface.

fields

public FieldDoc[] fields(boolean filter)
Return fields in this class or interface, filtered to the specified access modifier option

Parameters:
filter - Specify true to filter according to the specified access modifier option. Specify false to include all fields regardless of access modifier option.
Returns:
an array of FieldDoc objects representing the included fields in this class or interface.

methods

public MethodDoc[] methods()
Return included methods in this class or interface. Same as methods(true).

Returns:
an array of MethodDoc objects representing the included methods in this class or interface. Does not include constructors.

methods

public MethodDoc[] methods(boolean filter)
Return methods in this class or interface, filtered to the specified access modifier option. Does not include constructors.

Parameters:
filter - Specify true to filter according to the specified access modifier option. Specify false to include all methods regardless of access modifier option.
Returns:
an array of MethodDoc objects representing the included methods in this class or interface.

constructors

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

Returns:
an array of ConstructorDoc objects representing the included constructors in this class.

constructors

public ConstructorDoc[] constructors(boolean filter)
Return constructors in this class, filtered to the specified access modifier option. Return an array containing the default no-arg constructor if no other constructors exist.

Parameters:
filter - Specify true to filter according to the specified access modifier option. Specify false to include all constructors regardless of access modifier option.
Returns:
an array of ConstructorDoc objects representing the included constructors in this class.

innerClasses

public ClassDoc[] innerClasses()
Return included nested classes and interfaces within this class or interface. This includes both static and non-static nested classes. (This method should have been named nestedClasses(), as inner classes are technically non-static.) Anonymous and local classes or interfaces are not included.

Returns:
an array of ClassDoc objects representing the included classes and interfaces defined in this class or interface.

innerClasses

public ClassDoc[] innerClasses(boolean filter)
Return nested classes and interfaces within this class or interface filtered to the specified access modifier option. This includes both static and non-static nested classes. Anonymous and local classes are not included.

Parameters:
filter - Specify true to filter according to the specified access modifier option. Specify false to include all nested classes regardless of access modifier option.
Returns:
a filtered array of ClassDoc objects representing the included classes and interfaces defined in this class or interface.

findClass

public ClassDoc findClass(String className)
Find the specified class or interface within the context of this class doc. Search order: 1) qualified name, 2) nested in this class or interface, 3) in this package, 4) in the class imports, 5) in the package imports. Return the ClassDoc if found, null if not found.


importedClasses

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

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 Java Language Specification.

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-2003 Sun Microsystems, Inc. 4150 Network Circle
Santa Clara, California, 95054, U.S.A. All Rights Reserved.