Package net.bytebuddy.build
Enum CachedReturnPlugin.AdviceResolver
java.lang.Object
java.lang.Enum<CachedReturnPlugin.AdviceResolver>
net.bytebuddy.build.CachedReturnPlugin.AdviceResolver
- All Implemented Interfaces:
Serializable
,Comparable<CachedReturnPlugin.AdviceResolver>
,java.lang.constant.Constable
- Enclosing class:
CachedReturnPlugin
protected static enum CachedReturnPlugin.AdviceResolver
extends Enum<CachedReturnPlugin.AdviceResolver>
A resolver for
Advice
that caches a method's return type.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static class
A byte code appender for the exit advice.Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionA resolver for aboolean
type.A resolver for abyte
type.A resolver for achar
type.A resolver for adouble
type.A resolver for afloat
type.A resolver for aint
type.A resolver for along
type.A resolver for a reference type.A resolver for ashort
type. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final DynamicType
The created dynamic type to use for advice. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
AdviceResolver
(Class<?> type, int load, int store, int convert, int branch) Creates an advice resolver. -
Method Summary
Modifier and TypeMethodDescriptionprotected static CachedReturnPlugin.AdviceResolver
of
(TypeDefinition typeDefinition) Creates an advice resolver for a given type definition.protected Advice
Resolve advice for a given field name.Returns the enum constant of this type with the specified name.static CachedReturnPlugin.AdviceResolver[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
BOOLEAN
A resolver for aboolean
type. -
BYTE
A resolver for abyte
type. -
SHORT
A resolver for ashort
type. -
CHARACTER
A resolver for achar
type. -
INTEGER
A resolver for aint
type. -
LONG
A resolver for along
type. -
FLOAT
A resolver for afloat
type. -
DOUBLE
A resolver for adouble
type. -
REFERENCE
A resolver for a reference type.
-
-
Field Details
-
dynamicType
The created dynamic type to use for advice.
-
-
Constructor Details
-
AdviceResolver
Creates an advice resolver.- Parameters:
type
- The type of the return type.load
- The byte code that loads a value onto the stack from the local variable array.store
- The byte code that stores a value to the local variable array.convert
- An instruction to convert the cached value to a value that is applied on the branch instruction.branch
- A jump instruction that checks if the cached value is already set.
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
of
Creates an advice resolver for a given type definition.- Parameters:
typeDefinition
- The type definition for which advice is to be created.- Returns:
- An appropriate advice resolver.
-
toAdvice
Resolve advice for a given field name.- Parameters:
name
- The name of the field to resolve the advice for.- Returns:
- An appropriate advice.
-