Standard annotations in JAVA

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.