Class Parameter

java.lang.Object
org.springframework.r2dbc.core.Parameter

public final class Parameter extends Object
A database value that can be set in a statement.
Since:
5.3
Author:
Mark Paluch, Juergen Hoeller
  • Method Details

    • from

      public static Parameter from(Object value)
      Create a new Parameter from value.
      Parameters:
      value - the parameter value
      Returns:
      the Parameter value for value
    • fromOrEmpty

      public static Parameter fromOrEmpty(@Nullable Object value, Class<?> type)
      Create a new Parameter from value and type.
      Parameters:
      value - the parameter value (can be null)
      type - the parameter type
      Returns:
      the Parameter value for value
    • empty

      public static Parameter empty(Class<?> type)
      Create a new empty Parameter for type.
      Returns:
      the empty Parameter value for type
    • getValue

      @Nullable public Object getValue()
      Return the column value (can be null).
      See Also:
    • getType

      public Class<?> getType()
      Return the column value type. Must be also present if the value is null.
    • hasValue

      public boolean hasValue()
      Return whether this Parameter has a value.
      Returns:
      false if getValue() is null
    • isEmpty

      public boolean isEmpty()
      Return whether this Parameter has a empty.
      Returns:
      true if getValue() is null
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object