Package net.bytebuddy.implementation
Class Implementation.Context.Default.FieldCacheEntry
java.lang.Object
net.bytebuddy.implementation.Implementation.Context.Default.FieldCacheEntry
- All Implemented Interfaces:
StackManipulation
- Enclosing class:
Implementation.Context.Default
protected static class Implementation.Context.Default.FieldCacheEntry
extends Object
implements StackManipulation
A field cache entry for uniquely identifying a cached field. A cached field is described by the stack
manipulation that loads the field's value onto the operand stack and the type of the field.
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.bytebuddy.implementation.bytecode.StackManipulation
StackManipulation.AbstractBase, StackManipulation.Compound, StackManipulation.Illegal, StackManipulation.Simple, StackManipulation.Size, StackManipulation.Trivial
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final TypeDescription
The field type that is represented by this field cache entry.private final StackManipulation
The field value that is represented by this field cache entry. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
FieldCacheEntry
(StackManipulation fieldValue, TypeDescription fieldType) Creates a new field cache entry. -
Method Summary
Modifier and TypeMethodDescriptionapply
(org.objectweb.asm.MethodVisitor methodVisitor, Implementation.Context implementationContext) Applies the stack manipulation that is described by this instance.boolean
protected TypeDescription
Returns the field type that is represented by this field cache entry.int
hashCode()
boolean
isValid()
Determines if this stack manipulation is valid.protected ByteCodeAppender
storeIn
(FieldDescription fieldDescription) Returns a stack manipulation where the represented value is stored in the given field.
-
Field Details
-
fieldValue
The field value that is represented by this field cache entry. -
fieldType
The field type that is represented by this field cache entry.
-
-
Constructor Details
-
FieldCacheEntry
Creates a new field cache entry.- Parameters:
fieldValue
- The field value that is represented by this field cache entry.fieldType
- The field type that is represented by this field cache entry.
-
-
Method Details
-
storeIn
Returns a stack manipulation where the represented value is stored in the given field.- Parameters:
fieldDescription
- A static field in which the value is to be stored.- Returns:
- A byte code appender that represents this storage.
-
getFieldType
Returns the field type that is represented by this field cache entry.- Returns:
- The field type that is represented by this field cache entry.
-
isValid
public boolean isValid()Determines if this stack manipulation is valid.- Specified by:
isValid
in interfaceStackManipulation
- Returns:
- If
false
, this manipulation cannot be applied and should throw an exception.
-
apply
public StackManipulation.Size apply(org.objectweb.asm.MethodVisitor methodVisitor, Implementation.Context implementationContext) Applies the stack manipulation that is described by this instance.- Specified by:
apply
in interfaceStackManipulation
- Parameters:
methodVisitor
- The method visitor used to write the method implementation to.implementationContext
- The context of the current implementation.- Returns:
- The changes to the size of the operand stack that are implied by this stack manipulation.
-
hashCode
public int hashCode() -
equals
-