22

In my project, we use a number of annotations that would be very useful to see in the javadoc API documentation.

Does anyone know a simple way to include annotations in generated javadocs? I don't want to write my own javadoc plugin. Are there any solutions out there?

Elijah
  • 13,368
  • 10
  • 57
  • 89

1 Answers1

29

See java.lang.annotation.Documented

Indicates that annotations with a type are to be documented by javadoc and similar tools by default. This type should be used to annotate the declarations of types whose annotations affect the use of annotated elements by their clients. If a type declaration is annotated with Documented, its annotations become part of the public API of the annotated elements.

Example:

import java.lang.annotation.Documented;

@Documented
public @interface MyAnnotation {
}
Robert Munteanu
  • 67,031
  • 36
  • 206
  • 278
  • 5
    This doesn't help with annotations that are outside of one's control. For example, I'm dealing with JPA annotations that I really want to be left in my documentation output, but I can't control their use of `@Documented` – Pawel Veselov Jan 02 '19 at 09:43