Package net.bytebuddy.build
Enum CachedReturnPlugin.AdviceResolver
- java.lang.Object
-
- java.lang.Enum<CachedReturnPlugin.AdviceResolver>
-
- net.bytebuddy.build.CachedReturnPlugin.AdviceResolver
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<CachedReturnPlugin.AdviceResolver>
- Enclosing class:
- CachedReturnPlugin
protected static enum CachedReturnPlugin.AdviceResolver extends java.lang.Enum<CachedReturnPlugin.AdviceResolver>
A resolver forAdvice
that caches a method's return type.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
CachedReturnPlugin.AdviceResolver.ExitAdviceByteCodeAppender
A byte code appender for the exit advice.
-
Enum Constant Summary
Enum Constants Enum Constant Description BOOLEAN
A resolver for aboolean
type.BYTE
A resolver for abyte
type.CHARACTER
A resolver for achar
type.DOUBLE
A resolver for adouble
type.FLOAT
A resolver for afloat
type.INTEGER
A resolver for aint
type.LONG
A resolver for along
type.REFERENCE
A resolver for a reference type.SHORT
A resolver for ashort
type.
-
Field Summary
Fields Modifier and Type Field Description private DynamicType
dynamicType
The created dynamic type to use for advice.
-
Constructor Summary
Constructors Modifier Constructor Description private
AdviceResolver(java.lang.Class<?> type, int load, int store, int convert, int branch)
Creates an advice resolver.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static CachedReturnPlugin.AdviceResolver
of(TypeDefinition typeDefinition)
Creates an advice resolver for a given type definition.protected Advice
toAdvice(java.lang.String name)
Resolve advice for a given field name.static CachedReturnPlugin.AdviceResolver
valueOf(java.lang.String 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 Detail
-
BOOLEAN
public static final CachedReturnPlugin.AdviceResolver BOOLEAN
A resolver for aboolean
type.
-
BYTE
public static final CachedReturnPlugin.AdviceResolver BYTE
A resolver for abyte
type.
-
SHORT
public static final CachedReturnPlugin.AdviceResolver SHORT
A resolver for ashort
type.
-
CHARACTER
public static final CachedReturnPlugin.AdviceResolver CHARACTER
A resolver for achar
type.
-
INTEGER
public static final CachedReturnPlugin.AdviceResolver INTEGER
A resolver for aint
type.
-
LONG
public static final CachedReturnPlugin.AdviceResolver LONG
A resolver for along
type.
-
FLOAT
public static final CachedReturnPlugin.AdviceResolver FLOAT
A resolver for afloat
type.
-
DOUBLE
public static final CachedReturnPlugin.AdviceResolver DOUBLE
A resolver for adouble
type.
-
REFERENCE
public static final CachedReturnPlugin.AdviceResolver REFERENCE
A resolver for a reference type.
-
-
Field Detail
-
dynamicType
private final DynamicType dynamicType
The created dynamic type to use for advice.
-
-
Constructor Detail
-
AdviceResolver
private AdviceResolver(java.lang.Class<?> type, int load, int store, int convert, int branch)
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 Detail
-
values
public static CachedReturnPlugin.AdviceResolver[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (CachedReturnPlugin.AdviceResolver c : CachedReturnPlugin.AdviceResolver.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static CachedReturnPlugin.AdviceResolver valueOf(java.lang.String name)
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:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
of
protected static CachedReturnPlugin.AdviceResolver of(TypeDefinition typeDefinition)
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
protected Advice toAdvice(java.lang.String name)
Resolve advice for a given field name.- Parameters:
name
- The name of the field to resolve the advice for.- Returns:
- An appropriate advice.
-
-