Annotating an annotation- II
26 July 2008This post is continued form the last one. Do read that one first.
I will now present an example that shows the ElementType enum :
package java.lang.annotation; public enum ElementType { TYPE, // Class, interface, or enum (but not annotation) FIELD, // Field (including enumerated values) METHOD, // Method (does not include constructors) PARAMETER, // Method parameter CONSTRUCTOR, // Constructor LOCAL_VARIABLE, // Local variable or catch clause ANNOTATION_TYPE, // Annotation Types (meta-annotations) PACKAGE // Java package }
The enumerated values in exampel above are obvious. When you use the Target meta-annotation, you supply it at least one of these enumerated values and indicate
which program elements the annotated annotation can target.
Continued …
Related Posts:
Top Of Page | Trackback
If you found this page useful, consider linking to it. Simply copy and paste the code below into your web site.
It will look like this: Annotating an annotation- II