How to @link to a Enum Value using Javadoc Ask Question

How to @link to a Enum Value using Javadoc Ask Question

Using Javadoc 1.5, I have been unable to create a @link to an Enumeration value.

What I would like to do is to create an Enum like this:

public enum Planet { 

/**
* MERCURY is a fun place.
*/
MERCURY, 

/**
* VENUS is more fun.
*/
VENUS, 

/**
* But nothing beats the Earth.
*/
EARTH,

/**
* Others we know nothing about.
*/ 
OTHERS
}

And then refer to the Javadoc for Earth using a link like this:

{@link Planet.EARTH}

I have tried the {@link Planet#EARTH} style too, but to no avail.

Anyone know if this is doable at all?

ベストアンサー1

The # style works for me:

{@link Planet#EARTH}

The key is that the Planet package must be imported, or Planet must be fully qualified - i.e.:

{@link com.yourpackage.Planet#EARTH}

おすすめ記事