Top Description Fields Constructors Methods
java.lang.annotation

public final Enum RetentionPolicy

extends Enum<RetentionPolicy>
Class Inheritance

Annotation retention policy. The constants of this enumerated class describe the various policies for retaining annotations. They are used in conjunction with the Retention meta-annotation interface to specify how long annotations are to be retained.
Author
Joshua Bloch
Since
1.5

Field Summary

Modifier and TypeField and Description
public static final RetentionPolicy
CLASS

Annotations are to be recorded in the class file by the compiler but need not be retained by the VM at run time.

public static final RetentionPolicy
RUNTIME

Annotations are to be recorded in the class file by the compiler and retained by the VM at run time, so they may be read reflectively.

public static final RetentionPolicy
SOURCE

Annotations are to be discarded by the compiler.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static RetentionPolicy
public static RetentionPolicy[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

CLASSback to summary
public static final RetentionPolicy CLASS

Annotations are to be recorded in the class file by the compiler but need not be retained by the VM at run time. This is the default behavior.

RUNTIMEback to summary
public static final RetentionPolicy RUNTIME

Annotations are to be recorded in the class file by the compiler and retained by the VM at run time, so they may be read reflectively.

See Also
java.lang.reflect.AnnotatedElement
SOURCEback to summary
public static final RetentionPolicy SOURCE

Annotations are to be discarded by the compiler.

Constructor Detail

RetentionPolicyback to summary
private RetentionPolicy()

Method Detail

valueOfback to summary
public static RetentionPolicy valueOf(String name)
valuesback to summary
public static RetentionPolicy[] values()