A java blog with a collection of examples and tutorials on Java and related technologies. (Under maintenance with continuous updates)
Be in touch with java jazzle or k2java.blogspot.com.
Pages
▼
Wednesday, April 27, 2011
Retention annotation in java
@Retention indicates how long annotations whose annotated types are annotated
@Retention are to be retained.
The value of @Retention can be one of the members of the java.lang.annotation.
RetentionPolicy enum:
SOURCE. Annotations are to be discarded by the Java compiler.
CLASS. Annotations are to be recorded in the class file but not be retained by the JVM.
This is the default value.
RUNTIME. Annotations are to be retained by the JVM so you can query them using reflection.
No comments:
Post a Comment