Class FieldProxy.Binder.AccessorProxy
- java.lang.Object
-
- net.bytebuddy.implementation.bind.annotation.FieldProxy.Binder.AccessorProxy
-
- All Implemented Interfaces:
AuxiliaryType
,StackManipulation
- Enclosing class:
- FieldProxy.Binder
@Enhance(includeSyntheticFields=true) protected class FieldProxy.Binder.AccessorProxy extends java.lang.Object implements AuxiliaryType, StackManipulation
A proxy type for accessing a field either by a getter or a setter.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.bytebuddy.implementation.auxiliary.AuxiliaryType
AuxiliaryType.NamingStrategy, AuxiliaryType.SignatureRelevant
-
Nested classes/interfaces inherited from interface net.bytebuddy.implementation.bytecode.StackManipulation
StackManipulation.Compound, StackManipulation.Illegal, StackManipulation.Size, StackManipulation.Trivial
-
-
Field Summary
Fields Modifier and Type Field Description private Assigner
assigner
The assigner to use.protected static java.lang.String
FIELD_NAME
The name of the field that stores the accessed instance if any.private FieldDescription
fieldDescription
The field that is being accessed.private FieldProxy.Binder.FieldResolver
fieldResolver
The field resolver to use.private TypeDescription
instrumentedType
The type which is accessed.private boolean
serializableProxy
true
if the generated proxy should be serializable.-
Fields inherited from interface net.bytebuddy.implementation.auxiliary.AuxiliaryType
DEFAULT_TYPE_MODIFIER
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AccessorProxy(FieldDescription fieldDescription, TypeDescription instrumentedType, FieldProxy.Binder.FieldResolver fieldResolver, Assigner assigner, boolean serializableProxy)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StackManipulation.Size
apply(org.objectweb.asm.MethodVisitor methodVisitor, Implementation.Context implementationContext)
Applies the stack manipulation that is described by this instance.boolean
isValid()
Determines if this stack manipulation is valid.DynamicType
make(java.lang.String auxiliaryTypeName, ClassFileVersion classFileVersion, MethodAccessorFactory methodAccessorFactory)
Creates a new auxiliary type.
-
-
-
Field Detail
-
FIELD_NAME
protected static final java.lang.String FIELD_NAME
The name of the field that stores the accessed instance if any.- See Also:
- Constant Field Values
-
fieldDescription
private final FieldDescription fieldDescription
The field that is being accessed.
-
instrumentedType
private final TypeDescription instrumentedType
The type which is accessed.
-
fieldResolver
private final FieldProxy.Binder.FieldResolver fieldResolver
The field resolver to use.
-
assigner
private final Assigner assigner
The assigner to use.
-
serializableProxy
private final boolean serializableProxy
true
if the generated proxy should be serializable.
-
-
Constructor Detail
-
AccessorProxy
protected AccessorProxy(FieldDescription fieldDescription, TypeDescription instrumentedType, FieldProxy.Binder.FieldResolver fieldResolver, Assigner assigner, boolean serializableProxy)
- Parameters:
fieldDescription
- The field that is being accessed.instrumentedType
- The type which is accessed.fieldResolver
- The field resolver to use.assigner
- The assigner to use.serializableProxy
-true
if the generated proxy should be serializable.
-
-
Method Detail
-
make
public DynamicType make(java.lang.String auxiliaryTypeName, ClassFileVersion classFileVersion, MethodAccessorFactory methodAccessorFactory)
Creates a new auxiliary type.- Specified by:
make
in interfaceAuxiliaryType
- Parameters:
auxiliaryTypeName
- The fully qualified binary name for this auxiliary type. The type should be in the same package than the instrumented type this auxiliary type is providing services to in order to allow package-private access.classFileVersion
- The class file version the auxiliary class should be written in.methodAccessorFactory
- A factory for accessor methods.- Returns:
- A dynamically created type representing this auxiliary type.
-
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.
-
-