Class MethodDelegationBinder.ParameterBinding.Unique<T>

java.lang.Object
net.bytebuddy.implementation.bind.MethodDelegationBinder.ParameterBinding.Unique<T>
Type Parameters:
T - The type of the identification token.
All Implemented Interfaces:
MethodDelegationBinder.ParameterBinding<T>, StackManipulation
Enclosing interface:
MethodDelegationBinder.ParameterBinding<T>

@Enhance public static class MethodDelegationBinder.ParameterBinding.Unique<T> extends Object implements MethodDelegationBinder.ParameterBinding<T>
A uniquely identifiable parameter binding for a target method. Such bindings are usually later processed by a MethodDelegationBinder.AmbiguityResolver in order to resolve binding conflicts between several bindable target methods to the same source method.
See Also:
  • Field Details

    • identificationToken

      private final T identificationToken
      The token that identifies this parameter binding as unique.
    • delegate

      private final StackManipulation delegate
      The stack manipulation that represents the loading of the parameter binding onto the stack.
  • Constructor Details

    • Unique

      public Unique(StackManipulation delegate, T identificationToken)
      Creates a new unique parameter binding representant.
      Parameters:
      delegate - The stack manipulation that loads the argument for this parameter onto the operand stack.
      identificationToken - The token used for identifying this parameter binding.
  • Method Details

    • of

      public static <S> MethodDelegationBinder.ParameterBinding.Unique<S> of(StackManipulation delegate, S identificationToken)
      A factory method for creating a unique binding that infers the tokens type.
      Type Parameters:
      S - The type of the identification token.
      Parameters:
      delegate - The stack manipulation delegate.
      identificationToken - The identification token.
      Returns:
      A new instance representing this unique binding.
    • getIdentificationToken

      public T getIdentificationToken()
      Returns an identification token for this binding.
      Specified by:
      getIdentificationToken in interface MethodDelegationBinder.ParameterBinding<T>
      Returns:
      An identification token unique to this binding.
    • isValid

      public boolean isValid()
      Determines if this stack manipulation is valid.
      Specified by:
      isValid in interface StackManipulation
      Returns:
      If false, this manipulation cannot be applied and should throw an exception.
    • 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 interface StackManipulation
      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.