public static class MethodDelegationBinder.MethodBinding.Builder
extends java.lang.Object
MethodDelegationBinder.MethodBinding
by adding parameter bindings incrementally.Modifier and Type | Class and Description |
---|---|
protected static class |
MethodDelegationBinder.MethodBinding.Builder.Build
A method binding that was created by a
MethodDelegationBinder.MethodBinding.Builder . |
Modifier and Type | Field and Description |
---|---|
private MethodDescription |
candidate
The target method that for which a binding is to be constructed by this builder..
|
private MethodDelegationBinder.MethodInvoker |
methodInvoker
The method invoker for invoking the actual method that is bound.
|
private int |
nextParameterIndex
The index of the next parameter that is to be bound.
|
private java.util.List<StackManipulation> |
parameterStackManipulations
The 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> |
registeredTargetIndices
A mapping of identification tokens to the parameter index they were bound for.
|
Constructor and Description |
---|
Builder(MethodDelegationBinder.MethodInvoker methodInvoker,
MethodDescription candidate)
Creates a new builder for the binding of a given method.
|
Modifier and Type | Method and Description |
---|---|
boolean |
append(MethodDelegationBinder.ParameterBinding<?> parameterBinding)
Appends a stack manipulation for the next parameter of the target method.
|
MethodDelegationBinder.MethodBinding |
build(StackManipulation terminatingManipulation)
Creates a binding that represents the bindings collected by this
Builder . |
private final MethodDelegationBinder.MethodInvoker methodInvoker
private final MethodDescription candidate
private final java.util.List<StackManipulation> parameterStackManipulations
private final java.util.LinkedHashMap<java.lang.Object,java.lang.Integer> registeredTargetIndices
private int nextParameterIndex
public Builder(MethodDelegationBinder.MethodInvoker methodInvoker, MethodDescription candidate)
methodInvoker
- The method invoker that is used to create the method invocation of the target
method.candidate
- The target method that is target of the binding.public boolean append(MethodDelegationBinder.ParameterBinding<?> parameterBinding)
parameterBinding
- A binding representing the next subsequent parameter of the method.false
if the parameterBindingToken
was already bound. A conflicting binding should
usually abort the attempt of binding a method and this Builder
should be discarded.public MethodDelegationBinder.MethodBinding build(StackManipulation terminatingManipulation)
Builder
.terminatingManipulation
- A stack manipulation that is applied after the method invocation.