Java Annotation Processor

Source: Internet
Author: User

These days look at the company a new feature of the middleware support for async, which uses the annotation processor to automatically generate asynchronous interfaces. Just read how to use annotations and compile-time annotation processor, some of the study notes it!

The Java annotations and annotations processor mentioned here are not run-time annotations and processors that use class objects and reflection to handle! Instead, the source file annotations (Retentionpolicy.source) are processed at compile time, and the annotation processor (Annotation Processor) is a tool for Javac, which is used to scan and process annotations (Annotation) at compile time. You can customize the annotations and register the appropriate annotation processor.

Use

Compile-time note processor with Java source files as input, generate files (typically Java source files, is generated not modified) as output; These generated Java files are compiled in the same way as other normal, manually written Java source code Javac. So generally back to compile-time annotation processing to automatically generate more cumbersome code or through the automatic generation of code to achieve compatibility with new features of the demand

Java source files

Since the input of the compile-time annotation processor is the Java source file. Well, let's see what he does with the source file.

Compile-time annotations the processor sees the Java source file as a structured text rather than a compiled Java source file; the parts of the source code are a specific type of element, in other words: Element elements that represent a program, such as a package, class, or method. Each Element represents a static, language-level artifact. There are several types of element defined in Java:

(not finished)

Reference

https://race604.com/annotation-processing/

Http://www.cnblogs.com/avenwu/p/4173899.html

http://blog.csdn.net/haveferrair/article/details/52182927

http://blog.csdn.net/qinxiandiqi/article/details/49182735

http://blog.csdn.net/ucxiii/article/details/52025005

Java Annotation Processor

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.