Java Reference
In-Depth Information
date
= "4/1/2004"
)
public static void travelThroughTime(Date destination) { ... }
Here is an example of a normal annotation that takes advantage of default values.
@RequestForEnhancement(
id = 4561414,
synopsis = "Balance the federal budget"
)
public static void balanceFederalBudget() {
throw new UnsupportedOperationException("Not implemented");
}
Note that the types of the annotations in the examples in this section are the annotation
annotation are in the same order as in the corresponding annotation type declaration.
This is not required, but unless specific circumstances dictate otherwise, it is a reas-
onable convention to follow.
9.7.2. Marker Annotations
The second form of annotation,
marker annotation
, is a shorthand designed for use with
marker annotation types.
MarkerAnnotation:
@
Identifier
It is shorthand for the normal annotation:
@Identifier()
It is legal to use the marker annotation form for annotation types with elements, so long as
all the elements have default values.
Example 9.7.2-1. Marker Annotations
@Preliminary public class TimeTravel { ... }