RetentionPolicy
public
final
enum
RetentionPolicy
extends Enum<RetentionPolicy>
java.lang.Object | ||
↳ | java.lang.Enum<java.lang.annotation.RetentionPolicy> | |
↳ | java.lang.annotation.RetentionPolicy |
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.
Summary
Enum values | |
---|---|
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. |
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. |
RetentionPolicy |
SOURCE
Annotations are to be discarded by the compiler. |
Public methods | |
---|---|
static
RetentionPolicy
|
valueOf(String name)
|
static
final
RetentionPolicy[]
|
values()
|
Inherited methods | |
---|---|
Enum values
CLASS
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.
RUNTIME
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:
SOURCE
public static final RetentionPolicy SOURCE
Annotations are to be discarded by the compiler.
Public methods
valueOf
public static RetentionPolicy valueOf (String name)
Parameters | |
---|---|
name |
String |
Returns | |
---|---|
RetentionPolicy |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
TMZ Celebrity News – Breaking Stories, Videos & Gossip
Looking for the latest TMZ celebrity news? You've come to the right place. From shocking Hollywood scandals to exclusive videos, TMZ delivers it all in real time.
Whether it’s a red carpet slip-up, a viral paparazzi moment, or a legal drama involving your favorite stars, TMZ news is always first to break the story. Stay in the loop with daily updates, insider tips, and jaw-dropping photos.
🎥 Watch TMZ Live
TMZ Live brings you daily celebrity news and interviews straight from the TMZ newsroom. Don’t miss a beat—watch now and see what’s trending in Hollywood.
- Exclusive TMZ interviews and court updates
- Viral celebrity videos and candid photos
- Trending gossip and entertainment news