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.
Click here to view code image
@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
types defined in the examples in § 9.6 . Note also that the elements are in the above
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
Here is an example using the Preliminary marker annotation type from § 9.6.1 :
@Preliminary public class TimeTravel { ... }
Search WWH ::




Custom Search