Class MethodDelegationBinder.MethodBinding.Builder.Build
- java.lang.Object
-
- net.bytebuddy.implementation.bind.MethodDelegationBinder.MethodBinding.Builder.Build
-
- All Implemented Interfaces:
MethodDelegationBinder.MethodBinding,StackManipulation
- Enclosing class:
- MethodDelegationBinder.MethodBinding.Builder
@Enhance protected static class MethodDelegationBinder.MethodBinding.Builder.Build extends java.lang.Object implements MethodDelegationBinder.MethodBinding
A method binding that was created by aMethodDelegationBinder.MethodBinding.Builder.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.bytebuddy.implementation.bind.MethodDelegationBinder.MethodBinding
MethodDelegationBinder.MethodBinding.Builder, MethodDelegationBinder.MethodBinding.Illegal
-
Nested classes/interfaces inherited from interface net.bytebuddy.implementation.bytecode.StackManipulation
StackManipulation.Compound, StackManipulation.Size, StackManipulation.Trivial
-
-
Field Summary
Fields Modifier and Type Field Description private StackManipulationmethodInvocationA stack manipulation that represents the actual method invocation.private java.util.List<StackManipulation>parameterStackManipulationsA list of manipulations that each represent the loading of a parameter value onto the operand stack.private java.util.Map<?,java.lang.Integer>registeredTargetIndicesA map of identification tokens to the indices of their binding parameters.private MethodDescriptiontargetThe target method this binding represents.private StackManipulationterminatingStackManipulationThe stack manipulation that is applied after the method invocation.
-
Constructor Summary
Constructors Modifier Constructor Description protectedBuild(MethodDescription target, java.util.Map<?,java.lang.Integer> registeredTargetIndices, StackManipulation methodInvocation, java.util.List<StackManipulation> parameterStackManipulations, StackManipulation terminatingStackManipulation)Creates a new method binding.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StackManipulation.Sizeapply(org.objectweb.asm.MethodVisitor methodVisitor, Implementation.Context implementationContext)Applies the stack manipulation that is described by this instance.MethodDescriptiongetTarget()Returns the target method of the method binding attempt.java.lang.IntegergetTargetParameterIndex(java.lang.Object parameterBindingToken)Returns the target method's parameter index for a given parameter binding token.booleanisValid()Determines if this stack manipulation is valid.
-
-
-
Field Detail
-
target
private final MethodDescription target
The target method this binding represents.
-
registeredTargetIndices
private final java.util.Map<?,java.lang.Integer> registeredTargetIndices
A map of identification tokens to the indices of their binding parameters.
-
methodInvocation
private final StackManipulation methodInvocation
A stack manipulation that represents the actual method invocation.
-
parameterStackManipulations
private final java.util.List<StackManipulation> parameterStackManipulations
A list of manipulations that each represent the loading of a parameter value onto the operand stack.
-
terminatingStackManipulation
private final StackManipulation terminatingStackManipulation
The stack manipulation that is applied after the method invocation.
-
-
Constructor Detail
-
Build
protected Build(MethodDescription target, java.util.Map<?,java.lang.Integer> registeredTargetIndices, StackManipulation methodInvocation, java.util.List<StackManipulation> parameterStackManipulations, StackManipulation terminatingStackManipulation)
Creates a new method binding.- Parameters:
target- The target method this binding represents.registeredTargetIndices- A map of identification tokens to the indices of their binding parameters.methodInvocation- A stack manipulation that represents the actual method invocation.parameterStackManipulations- A list of manipulations that each represent the loading of a parameter value onto the operand stack.terminatingStackManipulation- The stack manipulation that is applied after the method invocation.
-
-
Method Detail
-
isValid
public boolean isValid()
Determines if this stack manipulation is valid.- Specified by:
isValidin interfaceStackManipulation- Returns:
- If
false, this manipulation cannot be applied and should throw an exception.
-
getTargetParameterIndex
public java.lang.Integer getTargetParameterIndex(java.lang.Object parameterBindingToken)
Returns the target method's parameter index for a given parameter binding token.
A binding token can be any object that implements validObject.hashCode()andObject.equals(Object)methods in order to look up a given binding. This way, two bindings can be evaluated of having performed a similar type of binding such that these bindings can be compared and a dominant binding can be identified by anMethodDelegationBinder.AmbiguityResolver. Furthermore, a binding is implicitly required to insure the uniqueness of such a parameter binding.- Specified by:
getTargetParameterIndexin interfaceMethodDelegationBinder.MethodBinding- Parameters:
parameterBindingToken- A token which is used to identify a specific unique binding for a given parameter of the target method.- Returns:
- The target method's parameter index of this binding or
nullif no such argument binding was applied for this binding.
-
getTarget
public MethodDescription getTarget()
Returns the target method of the method binding attempt.- Specified by:
getTargetin interfaceMethodDelegationBinder.MethodBinding- Returns:
- The target method to which the
-
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:
applyin 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.
-
-