javadoc标签

Posted leizhi

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了javadoc标签相关的知识,希望对你有一定的参考价值。

javadoc标签

The current tags are

Tag Introduced in JDK/SDK
@author 1.0
{@code} 1.5
{@docRoot}  1.3
@deprecated 1.0
@exception  1.0
{@inheritDoc}   1.4
{@link} 1.2
{@linkplain}    1.4
{@literal}  1.5
@param  1.0
@return 1.0
@see    1.0
@serial 1.2
@serialData 1.2
@serialField    1.2
@since  1.1
@throws 1.2
{@value}    1.4
@version    1.0

Package Documentation Tags

Package tags are tags that can appear in the documentation comment for a package (which resides in the source file named package.html). The @serial tag can only be used here with the include or exclude argument.
Package Tags
@see
@since
@serial
@author
@version
{@link}
{@linkplain}
{@docRoot}

Class and Interface Documentation Tags

The following are tags that can appear in the documentation comment for a class or interface. The @serial tag can only be used here with the include or exclude argument.
Class/Interface Tags
@see
@since
@deprecated
@serial
@author
@version
{@link}
{@linkplain}
{@docRoot}


An example of a class comment:

/**
 * A class representing a window on the screen.
 * For example:
 * <pre>
 *    Window win = new Window(parent);
 *    win.show();
 * </pre>
 *
 * @author  Sami Shaio
 * @version %I%, %G%
 * @see     java.awt.BaseWindow
 * @see     java.awt.Button
 */
class Window extends BaseWindow {
   ...
}

Field Documentation Tags

The following are the tags that can appear in the documentation comment for a field.
Field Tags
@see
@since
@deprecated
@serial
@serialField
{@link}
{@linkplain}
{@docRoot}
{@value}

An example of a field comment:
    /**
     * The X-coordinate of the component.
     *
     * @see #getLocation()
     */
    int x = 1263732;

Constructor and Method Documentation Tags

The following are the tags that can appear in the documentation comment for a constructor or method, except for @return, which cannot appear in a constructor, and {@inheritDoc}, which has certain restrictions. The @serialData tag can only be used in the doc comment for certain serialization methods.
Method/Constructor Tags
@see
@since
@deprecated
@param
@return
@throws and @exception
@serialData
{@link}
{@linkplain}
{@inheritDoc}
{@docRoot}

An example of a method doc comment:
    /**
     * Returns the character at the specified index. An index 
     * ranges from <code>0</code> to <code>length() - 1</code>.
     *
     * @param     index  the index of the desired character.
     * @return    the desired character.
     * @exception StringIndexOutOfRangeException 
     *              if the index is not in the range <code>0</code> 
     *              to <code>length()-1</code>.
     * @see       java.lang.Character#charValue()
     */
    public char charAt(int index) {
       ...
    }

参考文档

以上是关于javadoc标签的主要内容,如果未能解决你的问题,请参考以下文章

mvn命令异常:An error has occurred in Javadoc report generation: Unable to find javadoc command异常已解决(代码片段

javadoc 中的@uml.property 标签从何而来?

doxygen的使用给代码添加javadoc风格的注释

Javadoc写法和标签总结

Javadoc写法和标签总结

Javadoc写法和标签总结