Java SE defines a large number of annotation interfaces in the java.lang.annotation and javax.annotation packages.
Four of these are meta annotations (red ones), which describe the behavior properties of the annotation interface, and the other is the rule interface, which can be used to annotate items in your source code.
| Annotation interface |
Application Scenarios |
Purpose |
| Deprecated |
All |
Mark items as obsolete |
| Suppresswarnings |
In all cases except packages and annotations |
Block warning information for a given type |
| Override |
Method |
Check to see if the method overrides one of the superclass methods |
| Postconstruct |
Method |
The tagged method should be called immediately after construction |
| Predestroy |
The tagged method should be called immediately before being removed |
| Resource |
Class, interface, method, domain |
On a class or interface: A resource that is marked as being used elsewhere
On a method or field: Marked for "injection" |
| Resources |
Class, interface |
A resource group |
| grenerated |
All |
|
| Target |
Annotations |
Indicates the items that can be applied to this annotation |
| Retention |
Annotations |
Indicate how long this note can be retained |
| Documented |
Annotations |
Indicates that this annotation should be included in the document of the annotation item |
| Inherited |
Annotations |
Indicates that when this annotation is applied to a class, it can be inherited by his child class. |
Standard annotations in JAVA