Standard Annotations
JDK 5.0 defines seven annotation interfaces. Three of them are regular annotations that you can use to annotate items in your source code. The other four are meta-annotations that describe the behavior of annotation interfaces. Table 13-1 shows these annotations. We discuss them in detail in the following two sections.
Annotation Interface | Applicable To | Purpose |
---|---|---|
Deprecated | All | Marks item as deprecated |
SuppressWarnings | All but packages and annotations | Suppresses warnings of the given type |
Override | Methods | Checks that this method overrides a superclass method |
Target | Annotations | Specifies the items to which this annotation can be applied |
Retention | Annotations | Specifies how long this annotation is retained |
Get Core Java™ 2 Volume II - Advanced Features, Seventh Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.