Link to external URL in Javadoc?

This article was translated from: Linking to an external URL in Javadoc?

Something like: like:

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

#1st Floor

Reference: https://stackoom.com/question/4XUQ/ link to external URL in Javadoc


#2nd Floor

This creates a "See Also" heading containing the link, ie: This will create a "See Also" heading containing the link, ie :

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

will render as: will render as:

See Also: You can also see:
http://google.com http://google.com


whereas this :

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

will create an in-line link: will create an in-line link :

See http://google.com See http://google.com


#3rd floor

From at The taken javadoc spec from javadoc specification

@see <a href="URL#value">label</a>: Adds-Link AS A defined by URL#value. @see <a href="URL#value">label</a>: Add URL#valuea link definition. The URL#valueis a relative or absolute URL. URL#valueIs a relative or absolute URL. The Javadoc tool distinguishes this from other cases by looking for a less-than symbol ( <) as the first character. The Javadoc tool distinguishes other cases by finding the less-than symbol ( ) as the first character .<

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


#4th floor

Just use HTML link with a element

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


#5th Floor

Hard to find a clear answer from the Oracle site. It is difficult to find a clear answer from the Oracle website. Following from IS at The javax.ws.rs.core.HttpHeaders.java: The following is from 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";

#6th floor

Javadocs don't offer any special tools for external links, so you should just use standard html: Javadocs does not provide any special tools for external links, so you should use standard html:

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

or either

@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. Don't use or because these links point to javadoc of other classes and methods .{@link ...}{@linkplain ...}

Published 0 original articles · praised 75 · 560,000 views +

Guess you like

Origin blog.csdn.net/w36680130/article/details/105471839