Java's annotations

First, the introduction notes

  The concept notes : Notes is a program for a computer to read.

  Notes concept : words describing the program, the programmer to see.

  Annotation defines : Annotation (Annotation), also known as metadata. Describe a code level. It is a special effects JDK1.5 and later introduced the classes, interfaces, enumerations are on the same level. It can be declared in front of the packages, classes, fields, methods, local variables, methods and other parameters for these elements will be described, the comment.

  Concept description :

    •  New features of 1.5 after JDk
    •     Description of the process
    •     Use Notes: @ Name annotation

  Notes Role Category :

    •  Writing documentation: annotated code generated by the document identifier generated document doc [documentation]
    •     Code analysis: analyzed by annotating the code identity code [] using reflection
    •     Compile check: by annotating code identified so that the compiler can compile basic checking [Override]

Two, JDK predefined annotations

  JDk predefined number of notes:

    •  @Override: a method for detecting the labeled annotation whether inherited from the parent class (interface)
    •  @Deprecated: This comment marked content, expressed obsolete
    •     @SuppressWarnings: suppress warnings, general pass parameters all, suppress all warnings (@SuppressWarnings ( "all"))

Third, custom annotation

Fourth, the use (resolved) comments in the program

Fives,

Guess you like

Origin www.cnblogs.com/niujifei/p/11565127.html