Meta-annotations in Java annotations

Source: Internet
Author: User

One: meta-annotations in Java annotationsFour meta-annotations are: @Target, @Retention, @Documented, @Inherited,again, the following meta-annotations are provided by the Java API and are specifically used to define annotations, as follows:       @Target indicates where the annotation is used, and the possible values are in the enumeration class Elemenettype, including:            elemenettype.constructor----------------------------Builder Declaration             elemenettype.field-------------------------------------- Domain declarations (including enum instances)            elemenettype.local_ VARIABLE-------------------------local variable declaration             Elemenettype.method----------------------------------Method Declaration             elemenettype.package---------------------------------Package Declaration             elemenettype.parameter------------------------------Parameter Declaration             elemenettype.type---------------------------------------class, Interfaces (including annotation types) or enum declarations                   @Retention indicates at what level the annotation information is saved. The optional parameter values are in the enumeration type Retentionpolicy, including the:            Retentionpolicy.source---------------------------------annotations will be discarded by the compiler             retentionpolicy.class-----------------------------------annotations are available in the CLASS file, but are discarded by the VM             retentionpolicy.runtime VM-------will also retain comments at run time, The information of the annotations can therefore be read through the reflection mechanism.                   @ Documented includes this annotation in Javadoc, which means that the annotation is extracted as a document by the Javadoc tool. The content in the Doc document differs depending on the content of the information for this annotation.      quite with @see, @param and so on.               @Inherited allows subclasses to inherit annotations from the parent class.

Meta-Annotations in Java annotations

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.