java.lang.annotation包

Annotation

  • The common interface extended by all annotation types.

public interface Annotation

@Documented

  • Indicates that annotations with a type are to be documented by javadoc and similar tools by default.

@Inherited

  • Indicates that an annotation type is automatically inherited.

@Retention

  • Indicates how long annotations with the annotated type are to be retained.

    • RetentionPolicy.CLASS
    • RetentionPolicy.RUNTIME
    • RetentionPolicy.SOURCE

@Target

  • Indicates the contexts in which an annotation type is applicable.

    • ElementType.ANNOTATION_TYPE
    • ElementType.CONSTRUCTOR
    • ElementType.FIELD
    • ElementType.LOCAL_VARIABLE
    • ElementType.METHOD
    • ElementType.PACKAGE
    • ElementType.PARAMETER
    • ElementType.TYPE
    • ElementType.TYPE_PARAMETER
    • ElementType.TYPE_USE