Package com.sun.javadoc
Note: The declarations in this package have been superseded by those in the package jdk.javadoc.doclet
. For more information, see the Migration Guide in the documentation for that package.
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 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.
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 (-public
,
-protected
,
-package
, and
-private
) filter program elements, producing a result set, called the
included set, or "documented" set. (The unfiltered set is also available through
allClasses(false)
.)
Throughout this API, the term class is normally a shorthand for "class or interface", as in: ClassDoc
, allClasses()
, and findClass(String)
. In only a couple of other places, it means "class, as opposed to interface", as in: Doc.isClass()
. In the second sense, this API calls out four kinds of classes: ordinary classes, enums, errors and 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 java.lang.String
. A non-qualified name has no package name, such as String
.
Example
The following is an example doclet that 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()); } } } }Interfaces and methods from the Javadoc API are marked in red.
Doclet
is an abstract class that specifies the invocation interface for doclets,
Doclet
holds class or interface 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.utilproducing 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. ...
-
接口摘要 接口 描述 AnnotatedType Deprecated, for removal: This API element is subject to removal in a future version. The declarations in this package have been superseded by those in the packagejdk.javadoc.doclet
.AnnotationDesc Deprecated, for removal: This API element is subject to removal in a future version. The declarations in this package have been superseded by those in the packagejdk.javadoc.doclet
.AnnotationDesc.ElementValuePair Deprecated, for removal: This API element is subject to removal in a future version. The declarations in this package have been superseded by those in the packagejdk.javadoc.doclet
.AnnotationTypeDoc Deprecated, for removal: This API element is subject to removal in a future version. The declarations in this package have been superseded by those in the packagejdk.javadoc.doclet
.AnnotationTypeElementDoc Deprecated, for removal: This API element is subject to removal in a future version. The declarations in this package have been superseded by those in the packagejdk.javadoc.doclet
.AnnotationValue Deprecated, for removal: This API element is subject to removal in a future version. The declarations in this package have been superseded by those in the packagejdk.javadoc.doclet
.ClassDoc Deprecated, for removal: This API element is subject to removal in a future version. The declarations in this package have been superseded by those in the packagejdk.javadoc.doclet
.ConstructorDoc Deprecated, for removal: This API element is subject to removal in a future version. The declarations in this package have been superseded by those in the packagejdk.javadoc.doclet
.Doc Deprecated, for removal: This API element is subject to removal in a future version. The declarations in this package have been superseded by those in the packagejdk.javadoc.doclet
.DocErrorReporter Deprecated, for removal: This API element is subject to removal in a future version. The declarations in this package have been superseded by those in the packagejdk.javadoc.doclet
.ExecutableMemberDoc Deprecated, for removal: This API element is subject to removal in a future version. The declarations in this package have been superseded by those in the packagejdk.javadoc.doclet
.FieldDoc Deprecated, for removal: This API element is subject to removal in a future version. The declarations in this package have been superseded by those in the packagejdk.javadoc.doclet
.MemberDoc Deprecated, for removal: This API element is subject to removal in a future version. The declarations in this package have been superseded by those in the packagejdk.javadoc.doclet
.MethodDoc Deprecated, for removal: This API element is subject to removal in a future version. The declarations in this package have been superseded by those in the packagejdk.javadoc.doclet
.PackageDoc Deprecated, for removal: This API element is subject to removal in a future version. The declarations in this package have been superseded by those in the packagejdk.javadoc.doclet
.Parameter Deprecated, for removal: This API element is subject to removal in a future version. The declarations in this package have been superseded by those in the packagejdk.javadoc.doclet
.ParameterizedType Deprecated, for removal: This API element is subject to removal in a future version. The declarations in this package have been superseded by those in the packagejdk.javadoc.doclet
.ParamTag Deprecated, for removal: This API element is subject to removal in a future version. The declarations in this package have been superseded by those in the packagejdk.javadoc.doclet
.ProgramElementDoc Deprecated, for removal: This API element is subject to removal in a future version. The declarations in this package have been superseded by those in the packagejdk.javadoc.doclet
.RootDoc Deprecated, for removal: This API element is subject to removal in a future version. The declarations in this package have been superseded by those in the packagejdk.javadoc.doclet
.SeeTag Deprecated, for removal: This API element is subject to removal in a future version. The declarations in this package have been superseded by those in the packagejdk.javadoc.doclet
.SerialFieldTag Deprecated, for removal: This API element is subject to removal in a future version. The declarations in this package have been superseded by those in the packagejdk.javadoc.doclet
.SourcePosition Deprecated, for removal: This API element is subject to removal in a future version. The declarations in this package have been superseded by those in the packagejdk.javadoc.doclet
.Tag Deprecated, for removal: This API element is subject to removal in a future version. The declarations in this package have been superseded by those in the packagejdk.javadoc.doclet
.ThrowsTag Deprecated, for removal: This API element is subject to removal in a future version. The declarations in this package have been superseded by those in the packagejdk.javadoc.doclet
.Type Deprecated, for removal: This API element is subject to removal in a future version. The declarations in this package have been superseded by those in the packagejdk.javadoc.doclet
.TypeVariable Deprecated, for removal: This API element is subject to removal in a future version. The declarations in this package have been superseded by those in the packagejdk.javadoc.doclet
.WildcardType Deprecated, for removal: This API element is subject to removal in a future version. The declarations in this package have been superseded by those in the packagejdk.javadoc.doclet
. -
类摘要 类 描述 Doclet Deprecated, for removal: This API element is subject to removal in a future version. The declarations in this package have been superseded by those in the packagejdk.javadoc.doclet
. -
枚举摘要 Enum 描述 LanguageVersion Deprecated, for removal: This API element is subject to removal in a future version. The declarations in this package have been superseded by those in the packagejdk.javadoc.doclet
.