I use annotations to create documentation for the API that I am posting. I defined it as follows:
@Documented
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface PropertyInfo {
String description();
String since() default "5.8";
String link() default "";
}
Now this works great when I process classes using reflection. I can get a list of annotations by method. The problem is that it only works if I instantiate a new instance of the object that I am processing. I would prefer not to instantiate in order to get annotation. I tried RetentionPolicy.CLASS, but it does not work.
Any ideas?
source
share