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 Summary
Modifier and TypeMethodDescriptiondefault StringgetName()Returns the binding nameif presentor throwIllegalStateExceptionif no name associated.default intReturns the binding nameif presentor throwIllegalStateExceptionif no position associated.default booleanhasName()default booleanMap the name of the binding to a new name using the givenFunctionif the binding has a name.of(int position) Creates an identifier for the givenposition.Creates an identifier for the givenname.Creates an identifier for the givennameandposition.withPosition(int position) Associate a position with the binding.
-
Method Details
-
of
Creates an identifier for the givenname.- Parameters:
name-- Returns:
-
of
Creates an identifier for the givenposition.- Parameters:
position- 1-based index.- Returns:
-
of
Creates an identifier for the givennameandposition.- Parameters:
name-- Returns:
-
hasName
default boolean hasName()- Returns:
trueif the binding is associated with a name.
-
hasPosition
default boolean hasPosition()- Returns:
trueif the binding is associated with a position index.
-
getName
Returns the binding nameif presentor throwIllegalStateExceptionif no name associated.- Returns:
- the binding name.
-
getPosition
default int getPosition()Returns the binding nameif presentor throwIllegalStateExceptionif no position associated.- Returns:
- the binding position.
-
mapName
Map the name of the binding to a new name using the givenFunctionif 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.BindingIdentifierif the binding has a name, otherwise the binding itself. - Since:
- 4.0
-
withPosition
Associate a position with the binding.- Parameters:
position-- Returns:
- the new binding identifier with the position.
- Since:
- 4.0
-