Annotations are notes in Java programs to instruct the Java compiler to do something. Java annotations were first defined in JSR 175, “A Metadata Facility for the Java Programming Language.” Later JSR 250, “Common Annotations for the Java Platform” added annotations for common concepts. Both specifications can be downloaded from http://www.jcp.org.
This chapter starts with an overview of annotations, and then teaches you how to use the standard and common annotations. It concludes with a discussion of how to write your own custom annotation types.
Annotations are notes for the Java compiler. When you annotate a program element in a source file, you add notes to the Java program elements in that source ...