The Annotation defined is by default applicable to all java constructs such as class, interface,
enumerations, constructors, fields, methods, method parameters, local variables, packages
and Annotations. However we can restrict this behavior by specifying target with
@Target annotation.
The possible targets are listed below,
ElementType.TYPE
Applicable to Java classes, interfaces, enumerations and Annotations.
ElementType.FIELD
Applicable to Java fields.
ElementType.METHOD
Applicable to Java methods.
ElementType.PARAMETER
Applicable to Java method parameters.
ElementType.CONSTRUCTOR
Applicable to Java class constructors.
ElementType.LOCAL_VARIABLE
Applicable to Java local variables.
ElementType.ANNOTATION_TYPE
Applicable to Java annotations.
ElementType.PACKAGE
Applicable to Java packages.
A simple Annotation targeted to java types is shown below,