鏈接到Javadoc中的外部URL?

本文翻譯自:Linking to an external URL in Javadoc?

Something like: 就像是:

/**
 * See {@linktourl http://google.com}
 */

#1樓

參考:https://stackoom.com/question/4XUQ/鏈接到Javadoc中的外部URL


#2樓

This creates a "See Also" heading containing the link, ie: 這將創建一個包含鏈接的“另請參見”標題,即:

/**
 * @see <a href="http://google.com">http://google.com</a>
 */

will render as: 將呈現爲:

See Also: 也可以看看:
http://google.com http://google.com


whereas this: 而這個:

/**
 * See <a href="http://google.com">http://google.com</a>
 */

will create an in-line link: 將創建一個內嵌鏈接:

See http://google.com 請參閱http://google.com


#3樓

Taken from the javadoc spec 取自javadoc規範

@see <a href="URL#value">label</a> : Adds a link as defined by URL#value . @see <a href="URL#value">label</a> :添加URL#value定義的鏈接。 The URL#value is a relative or absolute URL. URL#value是相對或絕對URL。 The Javadoc tool distinguishes this from other cases by looking for a less-than symbol ( < ) as the first character. Javadoc工具通過查找小於號( < )作爲第一個字符來區別於其他情況。

For example : @see <a href="http://www.google.com">Google</a> 例如: @see <a href="http://www.google.com">Google</a>


#4樓

只需使用帶有a元素的HTML鏈接即可

<a href="URL#value">label</a>


#5樓

Hard to find a clear answer from the Oracle site. 很難從Oracle網站上找到明確的答案。 The following is from javax.ws.rs.core.HttpHeaders.java : 以下是來自javax.ws.rs.core.HttpHeaders.java

/**
 * See {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1">HTTP/1.1 documentation</a>}.
 */
public static final String ACCEPT = "Accept";

/**
 * See {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.2">HTTP/1.1 documentation</a>}.
 */
public static final String ACCEPT_CHARSET = "Accept-Charset";

#6樓

Javadocs don't offer any special tools for external links, so you should just use standard html: Javadocs不爲外部鏈接提供任何特殊工具,因此您應該使用標準html:

See <a href="http://groversmill.com/">Grover's Mill</a> for a history of the
Martian invasion.

or 要麼

@see <a href="http://groversmill.com/">Grover's Mill</a> for a history of 
the Martian invasion.

Don't use {@link ...} or {@linkplain ...} because these are for links to the javadocs of other classes and methods. 不要使用{@link ...}{@linkplain ...}因爲這些鏈接指向其他類和方法的javadoc。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章