Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

javadoc: @value to reference field in other class

Tags:

javadoc

/**  {@value Constants#KEY_MEAN} blah
     * {@value Constants#KEY_STDDEV}
     * @return A JSONObject with keys for mean and standardDeviation 
     */

When I use this javadoc outside Constants.java but inside the same package, eclipse will just output the plain text, and when generating Javadoc, nothing gets displayed. Is this at all possible?

like image 702
Nino van Hooff Avatar asked Jan 07 '13 15:01

Nino van Hooff


People also ask

How do you reference another 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.

How do you mention a method in Javadoc?

Using Tags. For example, most Javadoc comments for methods include " @param " and " @return " tags when applicable, to describe the method's parameters and return value. The " @param " tag should be followed by the parameter's name, and then a description of that parameter.

Do you write Javadoc for constructor?

Doc comments for constructorsIt's a best practice to include a constructor in a class. However, if the constructor is omitted, Javadoc automatically creates a constructor in the Javadoc but omits any description of the constructor.


1 Answers

Best start with the obvious. The referenced fields are static as well as not private, correct? e.g.,

public static final KEY_MEAN = 1337;

I've been working on figuring out my own similar javadoc questions today and pasting your code into my own, but changing to my class and field names, it worked as expected, "50000 blahaa 50000 Returns: A JSONObject with keys for mean and standardDeviation." This leads me to the question of verifying your field declaration in class Constants as a reasonable first measure.

like image 196
Grim0013 Avatar answered Jan 04 '23 11:01

Grim0013