Interface QueryParameterBinding<T>

Type Parameters:
T - The type of the query parameter
All Known Subinterfaces:
ProcedureParameterBinding<T>

@Incubating public interface QueryParameterBinding<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 Details

    • getQueryParameter

      QueryParameter<T> getQueryParameter()
      The query parameter associated with this binding.
    • isBound

      boolean isBound()
      Is any argument (even a null argument) currently bound to the parameter? That is, was one of the setBindValue(Object) or setBindValues(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 to setBindValue(Object) or setBindValues(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

      default void setBindValue(Object value)
      Set argument. If the given value is a Collection, 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

      void setBindValue(Object value, boolean resolveJdbcTypeIfNecessary)
      Set argument. If the given value is a Collection, 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

      <A> void setBindValue(A value, @Nullable BindableType<A> clarifiedType)
      Set the argument, specifying an explicit BindableType.
      Parameters:
      value - The argument
      clarifiedType - The explicit type
    • setBindValue

      void setBindValue(Object value, TemporalType temporalTypePrecision)
      Set the argument, specifying an explicit TemporalType. If the given value is a Collection, it might be interpreted as multiple arguments.
      Parameters:
      value - The argument
      temporalTypePrecision - 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

      void setBindValues(Collection<?> values)
      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 multivalued
      QueryArgumentException - if one of the values cannot be bound to the parameter
    • setBindValues

      <A> void setBindValues(Collection<? extends A> values, BindableType<A> clarifiedType)
      Attempt to set multiple arguments to the parameter, specifying an explicit BindableType.
      Parameters:
      values - The arguments
      clarifiedType - The explicit type
      Throws:
      IllegalArgumentException - if the parameter is not multivalued
      QueryArgumentException - if one of the values cannot be bound to the parameter
    • setBindValues

      void setBindValues(Collection<?> values, TemporalType temporalTypePrecision)
      Attempt to set multiple arguments to the parameter, specifying an explicit TemporalType.
      Parameters:
      values - The arguments
      temporalTypePrecision - The explicit temporal type
      Throws:
      IllegalArgumentException - if the parameter is not multivalued
      QueryArgumentException - 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

      boolean setType(@Nullable MappingModelExpressible<T> type)
      Sets the mapping model expressible for this parameter.
      Parameters:
      type - The mapping model expressible
      Returns:
      Whether the binding type was actually changed