What\'s the purpose of @Documented
annotation in java?
I saw the documentation, but could not get much from it. Can someone point out with the help of an cl
If some our annotation (for example, @InWork
) is @Documented
, then for every class having that @InWork
annotation the text generated by javadoc will contain @InWork
text, as a reference to the annotation.
Annotation:
@Documented
@Inherited // for descenders of the annotation to have the @Documented feature automatically
@Retention(RetentionPolicy.RUNTIME) // must be there
public @interface InWork {
String value();
}
Annotated target:
/**
* Annotated class.
*/
@InWork(value = "")
public class MainApp {...}
The javadoc text:
So, you have to decide, if the annotation should be shown in the javadoc text, and if yes, set @Documented
to it.
The information above is taken from Oracle documentation.
Please, notice, that in Eclipse you'll see in javadoc generated text ALL annotations, are they @Documented
, or not.
It is still correct for 4.3 version.