Java Documentation Comments

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.