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