Annotations are mainly used for:
We can apply annotations to a program's declarations of classes, fields, methods, and other program elements. Rather than directly affecting on the program's semantic, they do affect the way programs are treated by tools and libraries, that can affect the semantics of an executing program. We can read the annotations from the class file, source files, or at run time.
Annotations are processed by compiler plug-ins called
annotation processors whenever java source code is compiled. Processors are
capable of producing informational messages, create additional Java source
files or resources which in turn may be compiled and processed. But processors
cannot modify the annotated code itself. The Java compiler stores annotation
metadata in the class files only when the annotation has a RetentionPolicy of
CLASS or RUNTIME, that is used to determine how to interact with the program
elements or to change their behavior.
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.
Ask Questions? Discuss: Annotations
Post your Comment