com.sun.javadoc (Doclet API)

Package | Class | Use | Tree | Deprecated | Index | Help

Doclet API

PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES

## Package com.sun.javadoc

The javadoc API is used to customize the output of javadoc.

See:
Description

Interface Summary
ClassDoc | Represents a java class and provides access to information about the class, the class' comment and tags, and the members of the class.
ConstructorDoc | Represents a constructor of a java class.
Doc | abstract base class of all Doc classes.
DocErrorReporter | This interface provides error, warning and notice printing.
ExecutableMemberDoc | Represents a method or constructor of a java class.
FieldDoc | Represents a field in a java class.
MemberDoc | Represents a member of a java class: field, constructor, or method.
MethodDoc | Represents a method of a java class.
PackageDoc | Represents a java package.
Parameter | Parameter information.
ParamTag | Represents an @param documentation tag.
ProgramElementDoc | Represents a java program element: class, interface, field, constructor, or method.
RootDoc | This class holds the information from one run of javadoc.
SeeTag | Represents a see also documentation tag.
SerialFieldTag | Documents a Serializable field defined by an ObjectStreamField.
SourcePosition | This interface describes a source position: filename, line number, and column number.
Tag | Represents a documentation tag, e.g.
ThrowsTag | Represents a @throws or @exception documentation tag.
Type | Represents a java type.

Class Summary
Doclet | This class documents the entry-point methods in a Doclet.

## Package com.sun.javadoc Description

The javadoc API is used to customize the output of javadoc. Doclets are invoked by javadoc and use this API to obtain program structure information. The invocation is defined by the abstract Doclet class - the entry point is the start method:

        public static boolean start(RootDoc root)

The RootDoc instance holds the root of the program structure information. From this root all other program structure information can be extracted. For example, the following doclet displays information in the @param tags of the processed classes:

    import com.sun.javadoc.*;

    public class ListParams extends Doclet {

        public static boolean start(RootDoc root) {
            ClassDoc[] classes = root.classes();
            for (int i = 0; i < classes.length; ++i) {
                ClassDoc cd = classes[i];
                printMembers(cd.constructors());
                printMembers(cd.methods());
            }
            return true;
        }

        static void printMembers(ExecutableMemberDoc[] mems) {
            for (int i = 0; i < mems.length; ++i) {
                ParamTag[] params = mems[i].paramTags();
                System.out.println(mems[i].qualifiedName());
                for (int j = 0; j < params.length; ++j) {
                    System.out.println("   " + params[j].parameterName()
                        + " - " + params[j].parameterComment());
                }
            }
        }
    }

Methods from the javadoc API are marked in red. Interfaces from the javadoc API are marked in green (Doclet is an abstract class that specifies the invocation interface for doclets, ClassDoc holds class information, ExecutableMemberDoc is a superinterface of MethodDoc and ConstructorDoc, and ParamTag holds information from "@param" tags.

This doclet when invoked with a command line like:

        javadoc -doclet ListParams -sourcepath <source-location> java.util

produces output like:

        ...
        java.util.ArrayList.add
           index - index at which the specified element is to be inserted.
           element - element to be inserted.
        java.util.ArrayList.remove
           index - the index of the element to removed.
        ...

See Also:
  `Doclet`, `RootDoc`

Package | Class | Use | Tree | Deprecated | Index | Help

Doclet API

PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES

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.