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.utilproduces 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 com.sun.javadoc.Doclet @see com.sun.javadoc.RootDoc