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 forAdvicethat caches a method's return type.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classCachedReturnPlugin.AdviceResolver.ExitAdviceByteCodeAppenderA byte code appender for the exit advice.
-
Enum Constant Summary
Enum Constants Enum Constant Description BOOLEANA resolver for abooleantype.BYTEA resolver for abytetype.CHARACTERA resolver for achartype.DOUBLEA resolver for adoubletype.FLOATA resolver for afloattype.INTEGERA resolver for ainttype.LONGA resolver for alongtype.REFERENCEA resolver for a reference type.SHORTA resolver for ashorttype.
-
Field Summary
Fields Modifier and Type Field Description private DynamicTypedynamicTypeThe created dynamic type to use for advice.
-
Constructor Summary
Constructors Modifier Constructor Description privateAdviceResolver(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.AdviceResolverof(TypeDefinition typeDefinition)Creates an advice resolver for a given type definition.protected AdvicetoAdvice(java.lang.String name)Resolve advice for a given field name.static CachedReturnPlugin.AdviceResolvervalueOf(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 abooleantype.
-
BYTE
public static final CachedReturnPlugin.AdviceResolver BYTE
A resolver for abytetype.
-
SHORT
public static final CachedReturnPlugin.AdviceResolver SHORT
A resolver for ashorttype.
-
CHARACTER
public static final CachedReturnPlugin.AdviceResolver CHARACTER
A resolver for achartype.
-
INTEGER
public static final CachedReturnPlugin.AdviceResolver INTEGER
A resolver for ainttype.
-
LONG
public static final CachedReturnPlugin.AdviceResolver LONG
A resolver for alongtype.
-
FLOAT
public static final CachedReturnPlugin.AdviceResolver FLOAT
A resolver for afloattype.
-
DOUBLE
public static final CachedReturnPlugin.AdviceResolver DOUBLE
A resolver for adoubletype.
-
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.
-
-