Class Pipe.Binder.RedirectionProxy
java.lang.Object
net.bytebuddy.implementation.bytecode.StackManipulation.AbstractBase
net.bytebuddy.implementation.bind.annotation.Pipe.Binder.RedirectionProxy
- All Implemented Interfaces:
AuxiliaryType
,StackManipulation
- Enclosing class:
- Pipe.Binder
@Enhance
protected static class Pipe.Binder.RedirectionProxy
extends StackManipulation.AbstractBase
implements AuxiliaryType
An auxiliary type for performing the redirection of a method invocation as requested by the
Pipe
annotation.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static enum
The implementation to implement aPipe.Binder.RedirectionProxy
's constructor.protected static class
The implementation to implement aPipe.Binder.RedirectionProxy
's forwarding method.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.AbstractBase, StackManipulation.Compound, StackManipulation.Illegal, StackManipulation.Simple, StackManipulation.Size, StackManipulation.Trivial
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Assigner
The assigner to use.private static final String
The prefix for naming fields to store method arguments.private final TypeDescription
The type that declares the method for forwarding a method invocation.private final boolean
Determines if the generated proxy should beSerializable
.private final MethodDescription
The method that is to be forwarded.Fields inherited from interface net.bytebuddy.implementation.auxiliary.AuxiliaryType
DEFAULT_TYPE_MODIFIER
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
RedirectionProxy
(TypeDescription forwardingType, MethodDescription sourceMethod, Assigner assigner, boolean serializableProxy) Creates a new redirection. -
Method Summary
Modifier and TypeMethodDescriptionapply
(org.objectweb.asm.MethodVisitor methodVisitor, Implementation.Context implementationContext) Applies the stack manipulation that is described by this instance.private static LinkedHashMap<String,
TypeDescription> extractFields
(MethodDescription methodDescription) Extracts all parameters of a method to fields.private static String
fieldName
(int index) Creates a new field name.Produces a suffix that gives this auxiliary type a stable name.make
(String auxiliaryTypeName, ClassFileVersion classFileVersion, MethodAccessorFactory methodAccessorFactory) Creates a new auxiliary type.Methods inherited from class net.bytebuddy.implementation.bytecode.StackManipulation.AbstractBase
isValid
-
Field Details
-
FIELD_NAME_PREFIX
The prefix for naming fields to store method arguments.- See Also:
-
forwardingType
The type that declares the method for forwarding a method invocation. -
sourceMethod
The method that is to be forwarded. -
assigner
The assigner to use. -
serializableProxy
private final boolean serializableProxyDetermines if the generated proxy should beSerializable
.
-
-
Constructor Details
-
RedirectionProxy
protected RedirectionProxy(TypeDescription forwardingType, MethodDescription sourceMethod, Assigner assigner, boolean serializableProxy) Creates a new redirection.- Parameters:
forwardingType
- The type that declares the method for forwarding a method invocation.sourceMethod
- The method that is to be forwarded.assigner
- The assigner to use.serializableProxy
- Determines if the generated proxy should beSerializable
.
-
-
Method Details
-
extractFields
private static LinkedHashMap<String,TypeDescription> extractFields(MethodDescription methodDescription) Extracts all parameters of a method to fields.- Parameters:
methodDescription
- The method to extract the parameters from.- Returns:
- A linked hash map of field names to the types of these fields representing all parameters of the given method.
-
fieldName
Creates a new field name.- Parameters:
index
- The index of the field.- Returns:
- The field name that corresponds to the index.
-
getSuffix
Produces a suffix that gives this auxiliary type a stable name. A best effort is made that this suffix is unique.- Specified by:
getSuffix
in interfaceAuxiliaryType
- Returns:
- The suffix for this auxiliary type.
-
make
public DynamicType make(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.
-
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.
-