Contents | Package | Class | Tree | Index
PREV | NEXT SHOW LISTS | HIDE LISTS

Package sun.tools.javadoc

Interface Summary
Type Represents a java type.
 

Class Summary
ClassDoc Represents a java class.
ConstructorDoc Represents a constructor of a java class.
Doc abstract base class of all Doc classes.
Doclet This class documents the methods in a Doclet.
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.
ParamTag Represents an @param documentation tag.
Parameter Parameter information.
ProgramElementDoc Represents a java program element: class, interface, field, constructor, or method.
Root This class holds the information from one run of javadoc.
SeeTag Represents a see also documentation tag.
Tag Represents a documentation tag, e.g.
ThrowsTag Represents a @throws or @exception documentation tag.
 

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 invokation is defined by the abstract Doclet class - the entry point is the start method:

    public static boolean start(Root root)
The Root 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 sun.tools.javadoc.*;

public class ListParams extends Doclet {

    public static boolean start(Root 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. Classes from the javadoc API are marked in green (Doclet is an abstract class that specifies the invokation interface for doclets, ClassDoc holds class information, ExecutableMemberDoc is an abstract superclass 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, Root

Contents | Package | Class | Tree | Index
PREV | NEXT SHOW LISTS | HIDE LISTS