retention annotation---(Retention's translation reservation)
Retention (reserved) Note that this type of annotation is retained at that stage. There are three values:
1.retentionpolicy.source--This type of annotations is preserved only at the source level and is ignored at compile time
2.retentionpolicy.class--This type of annotations is preserved at compile time and exists in the CLASS file, but the JVM ignores
3.retentionpolicy.runtime--This type of annotations will be retained by the JVM, so they can be read and used by the JVM or other code that uses the reflection mechanism at runtime.
Documented annotations
Documented annotations indicate that this annotation should be recorded by the Javadoc tool. By default, Javadoc is not included in annotations. However, if a @Documented is specified when the annotation is declared, it is processed by a tool such as Javadoc, so the annotation type information is also included in the generated document.
Inherited annotated---(translation Genetics of inherited)
@Inherited: Allows subclasses to inherit annotations from the parent class.
@Target annotations
The target annotation illustrates the range of objects that annotation modifies: annotation can be used for packages, types (classes, interfaces, enumerations, annotation types), type members (methods, constructor methods, member variables, enumeration values), Method parameters and local variables (such as loop variables, catch parameters). Target can be more clearly decorated by using target in the declaration of the annotation type.
@Target (Elementtype.type)//interfaces, classes, enumerations, annotations
@Target (Elementtype.field)//fields, constants for enumerations
@Target (Elementtype.method)//method
@Target (Elementtype.parameter)//Method parameters
@Target (Elementtype.constructor)//constructor
@Target (elementtype.local_variable)//local variable
@Target (Elementtype.annotation_type)//annotations
@Target (Elementtype.package)///Package
Java annotations Retention, documented, inherited, Target introduction