連結
使用 @link
標記連結到其他 Javadoc:
/**
* You can link to the javadoc of an already imported class using {@link ClassName}.
*
* You can also use the fully-qualified name, if the class is not already imported:
* {@link some.other.ClassName}
*
* You can link to members (fields or methods) of a class like so:
* {@link ClassName#someMethod()}
* {@link ClassName#someMethodWithParameters(int, String)}
* {@link ClassName#someField}
* {@link #someMethodInThisClass()} - used to link to members in the current class
*
* You can add a label to a linked javadoc like so:
* {@link ClassName#someMethod() link text}
*/
使用 @see
標籤,你可以向 See also 部分新增元素。像 @param
或 @return
一樣,它們出現的地方無關緊要。規範說你應該在 @return
之後寫它。
/**
* This method has a nice explanation but you might found further
* information at the bottom.
*
* @see ClassName#someMethod()
*/
如果要新增**指向外部資源的連結,**只需使用 HTML <a>
標記即可。你可以在 @link
和 @see
標籤的任何位置或內部使用它。
/**
* Wondering how this works? You might want
* to check this <a href="http://stackoverflow.com/">great service</a>.
*
* @see <a href="http://stackoverflow.com/">Stack Overflow</a>
*/