Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does @link mean in java/Android documentation?

What does this mean:

{@link KeyEvent#KEYCODE_ENTER}

I have seen it a couple times and I'm not quite sure what it represents. I am writing a testing program using Robotium, JUnit, and Android. If anyone could offer some clarification on the subject, more specificly, the {@link} part, that would be great!

Thank you in advance.

like image 542
BlackHatSamurai Avatar asked Jul 12 '12 18:07

BlackHatSamurai


People also ask

What does @link do in Java?

This inserts an inline link with a visible text label. The text label points to the documentation for the specified package, class, or member name. This tag can be used everywhere, including an overview, package, class, method, field, etc.

What does documentation mean in Java?

Javadoc is a documentation tool for the Java programming language. The document it creates from the Java sources is in HTML format and describes the application programming interface.

How do you add a link to a Javadoc?

@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.

How do you link a class in Javadoc?

Javadoc provides the @link inline tag for referencing the members in the Java classes. We can think of the @link tag as similar to the anchor tag in HTML, which is used to link one page to another via hyperlinks. Similar to the anchor tag, the path_to_member is the destination, and the label is the display text.


2 Answers

I have not formally learned so perhaps someone can expand upon what I say.

It is shorthand that tells the java docs to insert a link to the desired place when they are being viewed. For instance when you view the javadocs for whatever method has that inside your IDE you'll be shown a link that will take you to the KeyEvent.KEYCODE_ENTER javadoc upon being clicked.

like image 60
FoamyGuy Avatar answered Oct 02 '22 16:10

FoamyGuy


It's an annotation used so when you generate the Javadoc, you'll have a link for the specified item. In this case, the KeyEvent class, with the anchor of KEYCODE_ENTER.

like image 38
Choker Avatar answered Oct 02 '22 16:10

Choker