The role of the Java Meta annotation is to annotate other annotations, java5.0 defines four standard meta-annotations: @Target, @Retention, @Inherit, @Documented.
1) @Target: Used to describe the types of annotations that can be decorated. The optional values are: (Elementtype.type)
Annotation_type (annotation type declaration)
Package (packages)
Type (class, interface, enumeration)
Methods (method declaration)
FIELD (member variable)
local_variable (local variable)
CONSTRUCTOR (Construction method)
The code is as follows:
@Documented @retention (retentionpolicy.runtime) @Target (elementtype.annotation_type) public @Interface target{ elementtype[] Value (); }
2) @Retention Note: Used to mark the action phase of the annotation, the following values are desirable: (Retentionpolicy.runtime)
Source: Works in the code, the compilation phase is removed;
Class: Can be compiled into a class file, but the JVM ignores it;
RUNTIME:JVM is used at run time.
3) Documented note: Used to indicate that this annotation should be recorded by the Javadoc tool
4) Inherit Annotations: Annotations that indicate that a subclass can inherit from a parent class.
Java meta annotations