Annotations and Annotation Types : Annotations Types « Language « Java Tutorial

Annotations are notes in Java programs to instruct the Java compiler to do something. Java provides three standard annotations and four standard meta-annotations.

  1. An annotation type is a special interface type.
  2. An annotation is an instance of an annotation type.
  3. An annotation type has a name and members.
  4. The information contained in an annotation takes the form of key/value pairs.
  5. There can be zero or multiple pairs and each key has a specific type.
  6. It can be a String, int, or other Java types.
  7. Annotation types with no key/value pairs are called marker annotation types.
  8. Those with one key/value pair are referred to single-value annotation types.
  1. There are three annotation types in Java 5: Deprecated, Override, and Suppress Warnings.
  2. There are four other annotation types that are part of the java.lang.annotation package: Documented, Inherited, Retention, and Target.
  3. These four annotation types are used to annotate annotations,

1.13.Annotations Types
1.13.1.Annotations and Annotation Types
1.13.2.The Annotation Interface
1.13.3.Using Default Values
1.13.4.Marker Annotations
1.13.5.Single-Member Annotations
1.13.6.Creates and uses a single-member annotation
1.13.7.The single-value syntax
1.13.8.Some Restrictions
1.13.9.A marker annotation