Java provides four types of meta-annotations that are specifically responsible for the creation of new annotations. Whenever you create a class or interface of a descriptor nature, once it contains repetitive work, you can consider using annotations to simplify and automate the process
@Target
Indicates where the annotation can be used, and the possible ElementType include:
CONSTRUCTOR: Declaration of the constructor
Field: Domain declarations (including enum instances)
local_variable: local variable declaration
Method: Methods Declaration
Package: Packet declaration
PARAMETER: Parameter declaration
Type: class, interface (including annotation type) or enum declaration
@Retention
Indicates the level at which the annotation information needs to be saved, the available retentiontype include
SOURCE: Annotations are discarded by the compiler
Class: Annotations are available in the class file, but are discarded by the VM
RUMTIME:VM will also retain annotations at run time, so the information of annotations can be read through the reflection mechanism
@Documented
Include this note in the Javadoc
@Inherited
Allow subclasses to inherit annotations from parent class
Java Annotation Learning Finishing