Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Annotations are notes in Java programs to instruct the Java compiler to do something. You can annotate any program elements, including Java packages, classes, constructors, fields, methods, parameters, and local variables. 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 annotations.