Class MethodDelegationBinder.MethodBinding.Builder
- java.lang.Object
-
- net.bytebuddy.implementation.bind.MethodDelegationBinder.MethodBinding.Builder
-
- Enclosing interface:
- MethodDelegationBinder.MethodBinding
public static class MethodDelegationBinder.MethodBinding.Builder extends java.lang.ObjectA mutable builder that allows to compose aMethodDelegationBinder.MethodBindingby adding parameter bindings incrementally.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classMethodDelegationBinder.MethodBinding.Builder.BuildA method binding that was created by aMethodDelegationBinder.MethodBinding.Builder.
-
Field Summary
Fields Modifier and Type Field Description private MethodDescriptioncandidateThe target method that for which a binding is to be constructed by this builder..private MethodDelegationBinder.MethodInvokermethodInvokerThe method invoker for invoking the actual method that is bound.private intnextParameterIndexThe index of the next parameter that is to be bound.private java.util.List<StackManipulation>parameterStackManipulationsThe current list of stack manipulations for loading values for each parameter onto the operand stack.private java.util.LinkedHashMap<java.lang.Object,java.lang.Integer>registeredTargetIndicesA mapping of identification tokens to the parameter index they were bound for.
-
Constructor Summary
Constructors Constructor Description Builder(MethodDelegationBinder.MethodInvoker methodInvoker, MethodDescription candidate)Creates a new builder for the binding of a given method.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanappend(MethodDelegationBinder.ParameterBinding<?> parameterBinding)Appends a stack manipulation for the next parameter of the target method.MethodDelegationBinder.MethodBindingbuild(StackManipulation terminatingManipulation)Creates a binding that represents the bindings collected by thisBuilder.
-
-
-
Field Detail
-
methodInvoker
private final MethodDelegationBinder.MethodInvoker methodInvoker
The method invoker for invoking the actual method that is bound.
-
candidate
private final MethodDescription candidate
The target method that for which a binding is to be constructed by this builder..
-
parameterStackManipulations
private final java.util.List<StackManipulation> parameterStackManipulations
The current list of stack manipulations for loading values for each parameter onto the operand stack.
-
registeredTargetIndices
private final java.util.LinkedHashMap<java.lang.Object,java.lang.Integer> registeredTargetIndices
A mapping of identification tokens to the parameter index they were bound for.
-
nextParameterIndex
private int nextParameterIndex
The index of the next parameter that is to be bound.
-
-
Constructor Detail
-
Builder
public Builder(MethodDelegationBinder.MethodInvoker methodInvoker, MethodDescription candidate)
Creates a new builder for the binding of a given method.- Parameters:
methodInvoker- The method invoker that is used to create the method invocation of thetargetmethod.candidate- The target method that is target of the binding.
-
-
Method Detail
-
append
public boolean append(MethodDelegationBinder.ParameterBinding<?> parameterBinding)
Appends a stack manipulation for the next parameter of the target method.- Parameters:
parameterBinding- A binding representing the next subsequent parameter of the method.- Returns:
falseif theparameterBindingTokenwas already bound. A conflicting binding should usually abort the attempt of binding a method and thisBuildershould be discarded.
-
build
public MethodDelegationBinder.MethodBinding build(StackManipulation terminatingManipulation)
Creates a binding that represents the bindings collected by thisBuilder.- Parameters:
terminatingManipulation- A stack manipulation that is applied after the method invocation.- Returns:
- A binding representing the parameter bindings collected by this builder.
-
-