Why does the definition of MyAnnotation need Documented, Inherited, Retention & RetentionPolicy?

Posted by cafe on Stack Overflow See other posts from Stack Overflow or by cafe
Published on 2010-04-01T07:19:38Z Indexed on 2010/04/01 7:23 UTC
Read the original article Hit count: 279

Filed under:
|

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 "";
}

© Stack Overflow or respective owner

Related posts about java

Related posts about annotations