Skip to content

Most visited

Recently visited

navigation
Added in API level 1

RetentionPolicy

public final enum RetentionPolicy
extends Enum<RetentionPolicy>

java.lang.Object
   ↳ java.lang.Enum<java.lang.annotation.RetentionPolicy>
     ↳ java.lang.annotation.RetentionPolicy


Defines an enumeration for annotation retention policies. Used in conjunction with the Retention annotation to specify an annotation's time-to-live in the overall development life cycle.

Summary

Enum values

RetentionPolicy  CLASS

Annotation is available in the source code and in the class file, but not at runtime. 

RetentionPolicy  RUNTIME

Annotation is available in the source code, the class file and is available at runtime. 

RetentionPolicy  SOURCE

Annotation is only available in the source code. 

Public methods

static RetentionPolicy valueOf(String name)
final static RetentionPolicy[] values()

Inherited methods

From class java.lang.Enum
From class java.lang.Object
From interface java.lang.Comparable

Enum values

CLASS

Added in API level 1
RetentionPolicy CLASS

Annotation is available in the source code and in the class file, but not at runtime. This is the default policy.

RUNTIME

Added in API level 1
RetentionPolicy RUNTIME

Annotation is available in the source code, the class file and is available at runtime.

SOURCE

Added in API level 1
RetentionPolicy SOURCE

Annotation is only available in the source code.

Public methods

valueOf

Added in API level 1
RetentionPolicy valueOf (String name)

Parameters
name String
Returns
RetentionPolicy

values

Added in API level 1
RetentionPolicy[] values ()

Returns
RetentionPolicy[]
This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.