Interface QueryParameterBinding<T>
- Type Parameters:
T- The type of the query parameter
- All Known Subinterfaces:
ProcedureParameterBinding<T>
The value and type binding information for a particular query parameter.
Can represent both single-valued and multivalued bindings of arguments
to a parameter.
The operations of this interface attempt to assign argument values to
the parameter of type T. If the argument cannot be coerced to
T, the operation fails and throws QueryArgumentException.
-
Method Summary
Modifier and TypeMethodDescription@Nullable BindableType<T> Get the type currently associated with this binding.Get the argument currently bound to the parameter.Collection<? extends T> Get the arguments currently bound to the parameter.@Nullable TemporalTypeIf the parameter is of a temporal type, return the explicitly specified precision, if any.The query parameter associated with this binding.@Nullable MappingModelExpressible<T> getType()Returns the inferred mapping model expressible, i.e., the model reference against which this parameter is compared.booleanisBound()Is any argument (even anullargument) currently bound to the parameter? That is, was one of thesetBindValue(Object)orsetBindValues(Collection)methods execute successfully?booleanIs the binding multivalued?<A> voidsetBindValue(A value, @Nullable BindableType<A> clarifiedType) Set the argument, specifying an explicitBindableType.default voidsetBindValue(Object value) Set argument.voidsetBindValue(Object value, boolean resolveJdbcTypeIfNecessary) Set argument.voidsetBindValue(Object value, TemporalType temporalTypePrecision) Set the argument, specifying an explicitTemporalType.voidsetBindValues(Collection<?> values) Attempt to set multiple arguments to the parameter.voidsetBindValues(Collection<?> values, TemporalType temporalTypePrecision) Attempt to set multiple arguments to the parameter, specifying an explicitTemporalType.<A> voidsetBindValues(Collection<? extends A> values, BindableType<A> clarifiedType) Attempt to set multiple arguments to the parameter, specifying an explicitBindableType.booleansetType(@Nullable MappingModelExpressible<T> type) Sets the mapping model expressible for this parameter.
-
Method Details
-
getQueryParameter
QueryParameter<T> getQueryParameter()The query parameter associated with this binding. -
isBound
boolean isBound()Is any argument (even anullargument) currently bound to the parameter? That is, was one of thesetBindValue(Object)orsetBindValues(Collection)methods execute successfully? -
isMultiValued
boolean isMultiValued()Is the binding multivalued? -
getBindType
@Nullable BindableType<T> getBindType()Get the type currently associated with this binding. By default, this is the type inferred from the parameter. It may be modified via a call tosetBindValue(Object)orsetBindValues(Collection).- Returns:
- The currently associated
BindableType
-
getExplicitTemporalPrecision
@Nullable TemporalType getExplicitTemporalPrecision()If the parameter is of a temporal type, return the explicitly specified precision, if any. -
setBindValue
Set argument. If the given value is aCollection, it might be interpreted as multiple arguments. Use the inherent type of the parameter.- Throws:
QueryArgumentException- if the value cannot be bound to the parameter
-
setBindValue
Set argument. If the given value is aCollection, it might be interpreted as multiple arguments. Use the inherent type of the parameter.- Parameters:
resolveJdbcTypeIfNecessary- Controls whether the parameter type should be resolved if necessary.- Throws:
QueryArgumentException- if the value cannot be bound to the parameter
-
setBindValue
Set the argument, specifying an explicitBindableType.- Parameters:
value- The argumentclarifiedType- The explicit type
-
setBindValue
Set the argument, specifying an explicitTemporalType. If the given value is aCollection, it might be interpreted as multiple arguments.- Parameters:
value- The argumenttemporalTypePrecision- The explicit temporal type- Throws:
QueryArgumentException- if the value cannot be bound to the parameter
-
getBindValue
T getBindValue()Get the argument currently bound to the parameter.- Returns:
- The argument currently bound
- Throws:
IllegalStateException- if the parameter is multivalued
-
setBindValues
Attempt to set multiple arguments to the parameter. Use the inherent type of the parameter.- Parameters:
values- The arguments- Throws:
IllegalArgumentException- if the parameter is not multivaluedQueryArgumentException- if one of the values cannot be bound to the parameter
-
setBindValues
Attempt to set multiple arguments to the parameter, specifying an explicitBindableType.- Parameters:
values- The argumentsclarifiedType- The explicit type- Throws:
IllegalArgumentException- if the parameter is not multivaluedQueryArgumentException- if one of the values cannot be bound to the parameter
-
setBindValues
Attempt to set multiple arguments to the parameter, specifying an explicitTemporalType.- Parameters:
values- The argumentstemporalTypePrecision- The explicit temporal type- Throws:
IllegalArgumentException- if the parameter is not multivaluedQueryArgumentException- if one of the values cannot be bound to the parameter
-
getBindValues
Collection<? extends T> getBindValues()Get the arguments currently bound to the parameter.- Returns:
- The arguments currently bound
- Throws:
IllegalArgumentException- if the parameter is not multivalued
-
getType
@Nullable MappingModelExpressible<T> getType()Returns the inferred mapping model expressible, i.e., the model reference against which this parameter is compared.- Returns:
- the inferred mapping model expressible or
null
-
setType
Sets the mapping model expressible for this parameter.- Parameters:
type- The mapping model expressible- Returns:
- Whether the binding type was actually changed
-