All Downloads are FREE. Search and download functionalities are using the official Maven repository.

gw.gosudoc.com.sun.javadoc.package-info Maven / Gradle / Ivy

The newest version!
/*
 * This file is a shadowed version of the older javadoc codebase on which gosudoc is based; borrowed from jdk 9.
 */

/**

Note: The declarations in this package have been superseded by those in the package {@link jdk.javadoc.doclet}. For more information, see the Migration Guide in the documentation for that package.

The Doclet API (also called the Javadoc API) provides a mechanism for clients to inspect the source-level structure of programs and libraries, including javadoc comments embedded in the source. This is useful for documentation, program checking, automatic code generation and many other tools.

Doclets are invoked by javadoc and use this API to write out program information to files. For example, the standard doclet is called by default and writes out documentation to HTML files.

The invocation is defined by the abstract {@link gw.gosudoc.com.sun.javadoc.Doclet} class -- the entry point is the {@link gw.gosudoc.com.sun.javadoc.Doclet#start(RootDoc) start} method:

    public static boolean start(RootDoc root)
The {@link gw.gosudoc.com.sun.javadoc.RootDoc} instance holds the root of the program structure information. From this root all other program structure information can be extracted.

Terminology

When calling javadoc, you pass in package names and source file names -- these are called the specified packages and classes. You also pass in Javadoc options; the access control Javadoc options ({@code -public}, {@code -protected}, {@code -package}, and {@code -private}) filter program elements, producing a result set, called the included set, or "documented" set. (The unfiltered set is also available through {@link gw.gosudoc.com.sun.javadoc.PackageDoc#allClasses(boolean) allClasses(false)}.)

Throughout this API, the term class is normally a shorthand for "class or interface", as in: {@link gw.gosudoc.com.sun.javadoc.ClassDoc}, {@link gw.gosudoc.com.sun.javadoc.PackageDoc#allClasses() allClasses()}, and {@link gw.gosudoc.com.sun.javadoc.PackageDoc#findClass(String) findClass(String)}. In only a couple of other places, it means "class, as opposed to interface", as in: {@link gw.gosudoc.com.sun.javadoc.Doc#isClass()}. In the second sense, this API calls out four kinds of classes: {@linkplain gw.gosudoc.com.sun.javadoc.Doc#isOrdinaryClass() ordinary classes}, {@linkplain gw.gosudoc.com.sun.javadoc.Doc#isEnum() enums}, {@linkplain gw.gosudoc.com.sun.javadoc.Doc#isError() errors} and {@linkplain gw.gosudoc.com.sun.javadoc.Doc#isException() exceptions}. Throughout the API, the detailed description of each program element describes explicitly which meaning is being used.

A qualified class or interface name is one that has its package name prepended to it, such as {@code java.lang.String}. A non-qualified name has no package name, such as {@code String}.

Example

The following is an example doclet that displays information in the {@code @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());
            }
        }
    }
}
Interfaces and methods from the Javadoc API are marked in red. {@link gw.gosudoc.com.sun.javadoc.Doclet Doclet} is an abstract class that specifies the invocation interface for doclets, {@link gw.gosudoc.com.sun.javadoc.Doclet Doclet} holds class or interface information, {@link gw.gosudoc.com.sun.javadoc.ExecutableMemberDoc} is a superinterface of {@link gw.gosudoc.com.sun.javadoc.MethodDoc} and {@link gw.gosudoc.com.sun.javadoc.ConstructorDoc}, and {@link gw.gosudoc.com.sun.javadoc.ParamTag} holds information from "{@code @param}" tags.

This doclet when invoked with a command line like:

    javadoc -doclet ListParams -sourcepath <source-location> java.util
producing 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 gw.gosudoc.com.sun.javadoc.Doclet @see gw.gosudoc.com.sun.javadoc.RootDoc */ package gw.gosudoc.com.sun.javadoc;




© 2015 - 2024 Weber Informatics LLC | Privacy Policy