Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the purpose of the '#' in javadocs '{@link #method}'?

Tags:

java

javadoc

What is the purpose of the hash '#' in the javadoc link tag?

/** Call {@link #method} to do foo. */
like image 833
Micha Wiedenmann Avatar asked Jan 17 '13 12:01

Micha Wiedenmann


People also ask

What is the purpose of the word the?

The word the is considered a definite article because it defines the meaning of a noun as one particular thing. It's an article that gives a noun a definite meaning: a definite article. Generally, definite articles are used to identify nouns that the audience already knows about.

Is it the purpose for or the purpose of?

The "purpose of" a shoe is protecting your feet. A possible "purpose for" a shoe is to smash bugs. So "purpose of" describes a property or capacity of a shoe, where "purpose for" describes what might be done with a shoe. Save this answer.

What is the purpose of and?

1 —used as a function word to indicate connection or addition especially of items within the same class or type —used to join sentence elements of the same grammatical rank or function. 2a —used as a function word to express logical modification, consequence, antithesis, or supplementary explanation.

What is the real purpose of life?

Your life purpose is your contribution However, true purpose is about recognizing your own gifts and using them to contribute to the world—whether those gifts are playing beautiful music for others to enjoy, helping friends solve problems, or simply bringing more joy into the lives of those around you.


1 Answers

Javadoc uses # as a separator between class and method/constructor signatures or field names to avoid ambiguous links.

The Javadoc @link and @see tags can be used with references to packages, classes and specific methods/constructors or fields within a class. It is perhaps not obvious, but it is legal to have e.g. a class "c" in the package "a.b" and a class "b" in the package "a" with a field called "c" in the same project. A Javadoc link to "package a.b, class c" would be written "a.b.c", whereas a link to "package a, class b, field c" would be written "a.b#c". If the name is distinct, the Javadoc tool will also accept the . separator before methods, constructors or fields.

If a link starts with #, it refers to a method/field/constructor in the same class. This is analogue to the anchor usage in HTTP urls, where href="doc.html#a1" refers to the "a1" anchor in "doc.html" and href="#a1" refers to the "a1" anchor in the same document.

like image 63
jarnbjo Avatar answered Nov 02 '22 15:11

jarnbjo