Java Reference
In-Depth Information
{@link <package.class#member> <label>}
It inserts an inline link with the specified
label
as the text for the link. This tag generates a link that is similar to the
link generated by one of the forms of the
@see
tag. The main difference between the two are that this tag is an inline
tag, whereas the
@see
tag is a block tag. The following documentation comment shows how to use this tag. The use of
this tag below will create a link with the text “add”, which will point to the documentation of the
add()
method of the
Calc
class.
/**
* A dummy class. Please see
* {@link com.jdojo.utility.Calc#add(int, int) add} method of the
* Calc class to learn how to add two integers.
*
*/
public class Dummy {
}
{@linkplain <package.class#member> <label>}
It works similarly to the
{@link}
tag, except that it displays the label for the link in plain text, whereas the
{@link}
displays the label for the link in code font. Please refer to the description of
{@link}
tag for more details.
{@literal <text>}
It displays the specified text without interpreting it as HTML markup or a nested documentation comment tag.
Note that HTML tags are enclosed in angle brackets (<>). If you want to use angle brackets in documentation
comments, you will need to use HTML entities
<
and
>
. If you do not want to use HTML entities, you can
use this tag with your raw text. For example, it is valid to write
{@literal x < y}
anywhere in the documentation
comment rather than writing
x < y
.
{@value <package.class#field>}
It is used to copy the value of a
static
and
final
field (a constant field). If it is used without the argument, it copies
the value of the constant field at its location. The following documentation comments show how to use
{@value}
tag.
In the documentation comment for
MULTIPLIER
field, it uses
{@value}
tag without an argument, which will insert the
value of the
MULTIPLIER
field. In the documentation comment for the
DIVISOR
field, it uses both forms of the
{@value}
tag, one with an argument and one without an argument. The argument,
#MULTIPLIER
, refers to the
MULTIPLIER
field
of the same class.
/**
* A dummy class.
*/
public class Dummy {
/**
* The MULTIPLIER is {@value}
*/
public static final int MULTIPLIER = 2000;
/**
* The value of MULTIPLIER is {@value #MULTIPLIER}.