链接到 Javadoc 中的外部 URL?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1082050/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Linking to an external URL in Javadoc?
提问by ripper234
Something like:
就像是:
/**
* See {@linktourl http://google.com}
*/
采纳答案by aem999
This creates a "See Also" heading containing the link, i.e.:
这将创建一个包含链接的“另请参阅”标题,即:
/**
* @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:
将创建一个内嵌链接:
回答by Aaron
Taken from the javadoc spec
@see <a href="URL#value">label</a>
:
Adds a link as defined by URL#value
. The URL#value
is a relative or absolute URL. The Javadoc tool distinguishes this from other cases by looking for a less-than symbol (<
) as the first character.
@see <a href="URL#value">label</a>
: 添加由 定义的链接URL#value
。该URL#value
是一个相对或绝对URL。Javadoc 工具通过查找小于号 ( <
) 作为第一个字符来将其与其他情况区分开来。
For example : @see <a href="http://www.google.com">Google</a>
例如 : @see <a href="http://www.google.com">Google</a>
回答by Dr. Max V?lkel
Just use an HTML link with an a-element like
只需使用带有 a 元素的 HTML 链接,例如
<a href="URL#value">label</a>
<a href="URL#value">label</a>
回答by Qiang Li
Hard to find a clear answer from the Oracle site. The following is from javax.ws.rs.core.HttpHeaders.java
:
很难从 Oracle 网站上找到明确的答案。以下内容来自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";
回答by Orlando DFree
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。