Javadoc Although Sun is designed for Java document Generation, it is possible to extract classes, methods, members, and other annotations from the program source code to form an API help document supporting the source code. But Javadoc's annotations also conform to the C annotation format, and Doxyen also supports comments of that style.
Official Document: Http://docs.oracle.com/javase/7/docs/technotes/tools/windows/javadoc.html
Wikipedia: Https://en.wikipedia.org/wiki/Javadoc
The annotation structure of Javadoc is similar to C. are annotated with/* * this structure.
Javadoc a lot of content, I just first study overview comments, class comments and method comments, and other later to learn. First, a few Java sample code is posted.
Overview:
/** * @author Firstname Lastname <address @ example.com> * @version 2010.0331 (e.g. ISO 8601 YYYY. MMDD) * @since 1.6 (the Java version used) */public class Test { //class body}
Class:
/** * 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 {
...}
Fields/Variables
/** * The x-coordinate of the component. * * @see #getLocation () */int x = 1263732;/** * The horizontal distances of point. */public int x;
Method:
/** * 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) {...} /** * Validates a chess move. * * @param thefromfile file from which a piece are being moved * @param thefromrank rank from which a piece is being moved * @param thetofile file to which a piece are being moved * @param thetorank rank to which a piece is being moved * @ret Urn True if the move is valid, otherwise false */boolean isvalidmove (int thefromfile, int thefromrank, int TheT ofile, int thetorank) {//... body}/** * Moves a chess piece. * * @see Java.math.RoundingMode */void Domove (int thefromfile, int thefromrank, int thetofile, int thetorank) {//... body}
In fact, these annotation forms are similar, mainly tag different below introduce tag and meaning.
Tag & Parameter |
Usage |
applies | to
Since |
@author name |
Describes an author. Description author |
Class, Interface |
|
@version version |
Provides version entry. Max one per Class or Interface. Version entries, each class or interface has a maximum of one |
Class, Interface |
|
@since Since-text |
Describes since when this functionality have existed. Describe when this function block is from |
Class, Interface, Field, Method |
|
@see Reference |
Provides a link to other element of documentation. Provide links to other document elements |
Class, Interface, Field, Method |
|
@param Name Description |
Describes a method parameter. Describe a parameter |
Method |
|
@return Description |
Describes the return value. Describe the return value |
Method |
|
@exception ClassName Description @throws ClassName Description |
Describes an exception, May is thrown from the This method. Describes an exception that may be thrown by this method |
Method |
|
@deprecated Description |
Describes an outdated method. Describe an outdated method |
Method |
|
{@inheritDoc} |
Copies the description from the overridden method. To describe a copy from a replication method |
overriding Method |
1.4.0 |
{@link reference } |
Link to other symbol. Connect to other references |
Class, Interface, Field, Method |
|
{@value} |
Return the value of a static field. Returns the value of a static scope |
Static Field |
1.4.0 |
JAVADOC Annotation Specification