Class MethodDelegationBinder.MethodBinding.Builder
java.lang.Object
net.bytebuddy.implementation.bind.MethodDelegationBinder.MethodBinding.Builder
- Enclosing interface:
MethodDelegationBinder.MethodBinding
A mutable builder that allows to compose a
MethodDelegationBinder.MethodBinding
by adding parameter bindings incrementally.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static class
A method binding that was created by aMethodDelegationBinder.MethodBinding.Builder
. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final MethodDescription
The target method that for which a binding is to be constructed by this builder..private final MethodDelegationBinder.MethodInvoker
The method invoker for invoking the actual method that is bound.private int
The index of the next parameter that is to be bound.private final List
<StackManipulation> The current list of stack manipulations for loading values for each parameter onto the operand stack.private final LinkedHashMap
<Object, Integer> A mapping of identification tokens to the parameter index they were bound for. -
Constructor Summary
ConstructorsConstructorDescriptionBuilder
(MethodDelegationBinder.MethodInvoker methodInvoker, MethodDescription candidate) Creates a new builder for the binding of a given method. -
Method Summary
Modifier and TypeMethodDescriptionboolean
append
(MethodDelegationBinder.ParameterBinding<?> parameterBinding) Appends a stack manipulation for the next parameter of the target method.build
(StackManipulation terminatingManipulation) Creates a binding that represents the bindings collected by thisBuilder
.
-
Field Details
-
methodInvoker
The method invoker for invoking the actual method that is bound. -
candidate
The target method that for which a binding is to be constructed by this builder.. -
parameterStackManipulations
The current list of stack manipulations for loading values for each parameter onto the operand stack. -
registeredTargetIndices
A mapping of identification tokens to the parameter index they were bound for. -
nextParameterIndex
private int nextParameterIndexThe index of the next parameter that is to be bound.
-
-
Constructor Details
-
Builder
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 thetarget
method.candidate
- The target method that is target of the binding.
-
-
Method Details
-
append
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:
false
if theparameterBindingToken
was already bound. A conflicting binding should usually abort the attempt of binding a method and thisBuilder
should be discarded.
-
build
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.
-