Reputation: 3540
I've a class something like below, where I would like to reference INVALID/APPLE/ORANGE constants when describing mCurrentFruit
. I didn't know a way to do this.
public class MyClass {
private static final int INVALID = -1;
private static final int APPLE = 1;
private static final int ORANGE = 2;
// Holds APPLE/ORANGE if currently chosen fruit is one among them, INVALID if user didn't choose anything
private int mCurrentFruit = 0;
public MyClass() {
//Do something here
}
}
Tried {@link MyClass.INVALID} and {@value MyClass.INVALID} both didn't work.
Some help would be appreciated !
Upvotes: 0
Views: 947
Reputation: 2621
Use /** .... */
blocks for JavaDocs.
How to Write Doc Comments for the Javadoc Tool
public class MyClass {
private static final int INVALID = -1;
private static final int APPLE = 1;
private static final int ORANGE = 2;
/**
* Holds {@link MyClass#APPLE} or {@link MyClass#ORANGE} if currently chosen fruit is one among them
* Otherwise, {@link MyClass#INVALID} if user didn't choose anything
*/
private int mCurrentFruit = 0;
public MyClass() {
//Do something here
}
}
Upvotes: 3