Why does the definition of MyAnnotation need Documented, Inherited, Retention & RetentionPolicy?
- by cafe
What is the purpose of these java.lang.annotation imports in this code? Why are they needed to define MyAnnotation?
import java.lang.annotation.Documented;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Inherited
public @interface MyAnnotation {
String value() default "";
}