Interface ParameterBinding.BindingIdentifier

Enclosing class:
ParameterBinding

public static sealed interface ParameterBinding.BindingIdentifier
Identifies a binding parameter by name, position or both. Used to bind parameters to a query or to describe a ParameterBinding.MethodInvocationArgument origin.
Since:
3.1.2
Author:
Mark Paluch
  • Method Details

    • of

      Creates an identifier for the given name.
      Parameters:
      name -
      Returns:
    • of

      static ParameterBinding.BindingIdentifier of(int position)
      Creates an identifier for the given position.
      Parameters:
      position - 1-based index.
      Returns:
    • of

      static ParameterBinding.BindingIdentifier of(String name, int position)
      Creates an identifier for the given name and position.
      Parameters:
      name -
      Returns:
    • hasName

      default boolean hasName()
      Returns:
      true if the binding is associated with a name.
    • hasPosition

      default boolean hasPosition()
      Returns:
      true if the binding is associated with a position index.
    • getName

      default String getName()
      Returns the binding name if present or throw IllegalStateException if no name associated.
      Returns:
      the binding name.
    • getPosition

      default int getPosition()
      Returns the binding name if present or throw IllegalStateException if no position associated.
      Returns:
      the binding position.
    • mapName

      ParameterBinding.BindingIdentifier mapName(Function<? super String, ? extends String> nameMapper)
      Map the name of the binding to a new name using the given Function if the binding has a name. If the binding is not associated with a name, then the binding is returned unchanged.
      Parameters:
      nameMapper - must not be null.
      Returns:
      the transformed ParameterBinding.BindingIdentifier if the binding has a name, otherwise the binding itself.
      Since:
      4.0
    • withPosition

      ParameterBinding.BindingIdentifier withPosition(int position)
      Associate a position with the binding.
      Parameters:
      position -
      Returns:
      the new binding identifier with the position.
      Since:
      4.0