Notes java programming @since 1.8

First, the basic raw notes:     

  @Retention:

    The notes explain the life cycle 

    RetentionPolicy.SOURCE -> left in code phase, ignored when compiling

    RetentionPolicy.CLASS -> remain in the compilation stage, it will not be loaded into the jvm

    RetentionPolicy.RUNTIME -> loaded into the jvm running  

  @Target:

    Specify the use of notes at

    ElementType.Type -> acting classes, interfaces, enumerations

    ElementType.FIELD -> Properties

    ElementType.METHOD -> method

    Parameters> Method - ElementType.PARAMETER 

    ElementType.CONSTRUCTOR -> Constructor

    ElementType.LOCAL_VARIABLE -> local variables

    ElementType.ANNOTATION_TYPE -> acting on notes

    ElementType.PACKAGE -> applied to the bag

    ElementType.TYPE_PARAMETER -> 

    ElementType.TYPE_USE ->  

  @Documented:

    File  

  @Inherited:

    Inheritance, role in the parent class subclass can have notes of the parent class

  @Repeatable:

 

    Show marked annotation can be applied to many times the same attribute or statement

      

 

 

 

    

    

 

Guess you like

Origin www.cnblogs.com/qinggg/p/11975955.html