Document annotations are used to generate API documentation, and APIs are used primarily to describe classes, methods, member variables
- The Javadoc tool handles comments from document source files before classes, interfaces, methods, member variables, constructors, and inner classes, ignoring document annotations elsewhere. The Javadoc tool, by default, only handles document annotations before classes, interfaces, methods, member variables, constructors, and inner classes that are decorated with public or protected.
- If the developer wants the Javadoc tool to extract the contents of the private adornment, the Javadoc tool can be used to increase the-private option
The basic usage of the Javadoc command is as follows:
Javadoc options Java source file | package
A Java source file can support wildcards:
For example, use *.java to represent all Java source files under the current path.
Common options for Javadoc:
- -d<directory>: This option specifies a path for the generated API document to be stored in the specified directory.
- -windowtitle<text>: This option specifies a string that sets the browser window caption for the API document.
- -doctitleoverview page is only available when the source file under the package is generated to generate the API documentation.
- -header
javadoc-d apidoc-windowtitle Test-doctitle Learning Javadoc Tools Test API documentation-header my class *test.java
Javadoc Tags:
- @author: Specifies the author of the Java program.
- @version: Specifies the version of the source file.
- @deprecated: Deprecated methods are used.
- @param: The parameter description of the method.
- @return: The return value of the method describes the information.
- @see: "See" for specifying cross-reference content.
- @exception: The type of exception thrown.
- @throws: Throws an exception, and @exception synonymous.
The use of the above markers has a position limit.
@see, @deprecated, @author, @version, etc. that appear in the class or interface documentation comments
@see, @deprecated, @param, @return, @throws, @exception, etc. that can appear in the method or constructor documentation comments
@see and @deprecated can appear in the document comments of the member variable
Java Documentation Comments