Top Description Fields Constructors Methods
net.bytebuddy.implementation.attribute

public final Enum AnnotationRetention

extends Enum<AnnotationRetention>
Class Inheritance

An annotation retention strategy decides if annotations that are contained within a class file are preserved upon redefining or rebasing a method. When annotations are retained, it is important not to define annotations explicitly that are already defined. When annotations are retained, they are retained in their original format, i.e. default values that were not included in the class file are not added or skipped as determined by a AnnotationValueFilter.

Field Summary

Modifier and TypeField and Description
public static final AnnotationRetention
DISABLED

Disables annotation retention, i.e. annotations within an existing class files are discarded.

public static final AnnotationRetention
ENABLED

Enables annotation retention, i.e. annotations within an existing class files are preserved as they are.

private final boolean
enabled

true if annotation retention is enabled.

Constructor Summary

AccessConstructor and Description
private
AnnotationRetention(boolean
true if annotation retention is enabled.
enabled
)

Creates an annotation retention strategy.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if annotation retention is enabled.
isEnabled
()

Returns true if annotation retention is enabled.

public static AnnotationRetention

Returns:

An enabled annotation retention if the value is true.
of
(boolean
true if annotation retention is enabled.
enabled
)

Resolves an annotation retention from a boolean value.

public static AnnotationRetention
public static AnnotationRetention[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

DISABLEDback to summary
public static final AnnotationRetention DISABLED

Disables annotation retention, i.e. annotations within an existing class files are discarded.

ENABLEDback to summary
public static final AnnotationRetention ENABLED

Enables annotation retention, i.e. annotations within an existing class files are preserved as they are.

enabledback to summary
private final boolean enabled

true if annotation retention is enabled.

Constructor Detail

AnnotationRetentionback to summary
private AnnotationRetention(boolean enabled)

Creates an annotation retention strategy.

Parameters
enabled:boolean

true if annotation retention is enabled.

Method Detail

isEnabledback to summary
public boolean isEnabled()

Returns true if annotation retention is enabled.

Returns:boolean

true if annotation retention is enabled.

ofback to summary
public static AnnotationRetention of(boolean enabled)

Resolves an annotation retention from a boolean value.

Parameters
enabled:boolean

true if annotation retention is enabled.

Returns:AnnotationRetention

An enabled annotation retention if the value is true.

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