March 2005
Beginner to intermediate
1254 pages
104h 21m
English
ElementType
The
constants
declared by this enumerated type represent the types of program
elements that can be annotated. The value of an
@Target annotation is an array of
ElementType constants. Most of the
constants
have obvious meanings, but some require additional explanation.
TYPE represents a class, interface, enumerated
type, or annotation type. ANNOTATION_TYPE
represents only annotation types and is used for meta-annotations.
FIELD includes enumerated constants, and
PARAMETER includes both method parameters and
catch clause parameters. Note that the
METHOD and CONSTRUCTOR are
distinct constants.
Figure 10-77. java.lang.annotation.ElementType
public enum ElementType { // Enumerated Constants TYPE, FIELD, METHOD, PARAMETER, CONSTRUCTOR, LOCAL_VARIABLE, ANNOTATION_TYPE, PACKAGE; // Public Class Methods public static ElementType valueOf(String name); public static final ElementType[ ] values( ); }
Target.value( )
Read now
Unlock full access