Class SqlValue

java.lang.Object
software.amazon.awssdk.services.context.model.SqlValue
All Implemented Interfaces:
Serializable, SdkPojo, ToCopyableBuilder<SqlValue.Builder,SqlValue>

@Generated("software.amazon.awssdk:codegen") public final class SqlValue extends Object implements SdkPojo, Serializable, ToCopyableBuilder<SqlValue.Builder,SqlValue>

One value. Exactly one member is set, and the column's type determines which member.

See Also:
  • Method Details

    • nullValue

      public final Boolean nullValue()

      Specifies whether the value is a SQL NULL. Always true when present.

      Returns:
      Specifies whether the value is a SQL NULL. Always true when present.
    • booleanValue

      public final Boolean booleanValue()

      A BOOLEAN column value.

      Returns:
      A BOOLEAN column value.
    • longValue

      public final Long longValue()

      A TINYINT, SMALLINT, INTEGER, or BIGINT column value.

      Returns:
      A TINYINT, SMALLINT, INTEGER, or BIGINT column value.
    • doubleValue

      public final Double doubleValue()

      REAL and DOUBLE, except NaN and infinities, which are stringValue (NaN, Infinity, -Infinity).

      Returns:
      REAL and DOUBLE, except NaN and infinities, which are stringValue (NaN, Infinity, -Infinity).
    • stringValue

      public final String stringValue()

      VARCHAR, and the types whose exact form is text: DECIMAL and unsigned 64-bit integers in plain notation, DATE ( yyyy-MM-dd), TIME and TIMESTAMP (ISO-8601 at the column's precision; Z when timeZone is set), and INTERVAL (ISO-8601 duration). An UNKNOWN column's values are NULL. A non-null value of a type the service cannot return fails the request with ValidationException (cast the column to VARCHAR).

      Returns:
      VARCHAR, and the types whose exact form is text: DECIMAL and unsigned 64-bit integers in plain notation, DATE (yyyy-MM-dd), TIME and TIMESTAMP (ISO-8601 at the column's precision; Z when timeZone is set), and INTERVAL (ISO-8601 duration). An UNKNOWN column's values are NULL. A non-null value of a type the service cannot return fails the request with ValidationException (cast the column to VARCHAR).
    • blobValue

      public final SdkBytes blobValue()

      A VARBINARY column value, as binary data.

      Returns:
      A VARBINARY column value, as binary data.
    • jsonValue

      public final String jsonValue()

      An ARRAY, STRUCT, or MAP column value, as JSON text: an array, an object, and an array of {"key": ..., "value": ...} entries. Nested values follow the same rules, with NULL as null.

      Returns:
      An ARRAY, STRUCT, or MAP column value, as JSON text: an array, an object, and an array of {"key": ..., "value": ...} entries. Nested values follow the same rules, with NULL as null.
    • toBuilder

      public SqlValue.Builder toBuilder()
      Description copied from interface: ToCopyableBuilder
      Take this object and create a builder that contains all of the current property values of this object.
      Specified by:
      toBuilder in interface ToCopyableBuilder<SqlValue.Builder,SqlValue>
      Returns:
      a builder for type T
    • builder

      public static SqlValue.Builder builder()
    • serializableBuilderClass

      public static Class<? extends SqlValue.Builder> serializableBuilderClass()
    • hashCode

      public final int hashCode()
      Overrides:
      hashCode in class Object
    • equals

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

      public final boolean equalsBySdkFields(Object obj)
      Description copied from interface: SdkPojo
      Indicates whether some other object is "equal to" this one by SDK fields. An SDK field is a modeled, non-inherited field in an SdkPojo class, and is generated based on a service model.

      If an SdkPojo class does not have any inherited fields, equalsBySdkFields and equals are essentially the same.

      Specified by:
      equalsBySdkFields in interface SdkPojo
      Parameters:
      obj - the object to be compared with
      Returns:
      true if the other object equals to this object by sdk fields, false otherwise.
    • toString

      public final String toString()
      Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be redacted from this string using a placeholder value.
      Overrides:
      toString in class Object
    • getValueForField

      public final <T> Optional<T> getValueForField(String fieldName, Class<T> clazz)
    • fromNullValue

      public static SqlValue fromNullValue(Boolean nullValue)
      Create an instance of this class with nullValue() initialized to the given value.

      Specifies whether the value is a SQL NULL. Always true when present.

      Parameters:
      nullValue - Specifies whether the value is a SQL NULL. Always true when present.
    • fromBooleanValue

      public static SqlValue fromBooleanValue(Boolean booleanValue)
      Create an instance of this class with booleanValue() initialized to the given value.

      A BOOLEAN column value.

      Parameters:
      booleanValue - A BOOLEAN column value.
    • fromLongValue

      public static SqlValue fromLongValue(Long longValue)
      Create an instance of this class with longValue() initialized to the given value.

      A TINYINT, SMALLINT, INTEGER, or BIGINT column value.

      Parameters:
      longValue - A TINYINT, SMALLINT, INTEGER, or BIGINT column value.
    • fromDoubleValue

      public static SqlValue fromDoubleValue(Double doubleValue)
      Create an instance of this class with doubleValue() initialized to the given value.

      REAL and DOUBLE, except NaN and infinities, which are stringValue (NaN, Infinity, -Infinity).

      Parameters:
      doubleValue - REAL and DOUBLE, except NaN and infinities, which are stringValue (NaN, Infinity, -Infinity).
    • fromStringValue

      public static SqlValue fromStringValue(String stringValue)
      Create an instance of this class with stringValue() initialized to the given value.

      VARCHAR, and the types whose exact form is text: DECIMAL and unsigned 64-bit integers in plain notation, DATE ( yyyy-MM-dd), TIME and TIMESTAMP (ISO-8601 at the column's precision; Z when timeZone is set), and INTERVAL (ISO-8601 duration). An UNKNOWN column's values are NULL. A non-null value of a type the service cannot return fails the request with ValidationException (cast the column to VARCHAR).

      Parameters:
      stringValue - VARCHAR, and the types whose exact form is text: DECIMAL and unsigned 64-bit integers in plain notation, DATE (yyyy-MM-dd), TIME and TIMESTAMP (ISO-8601 at the column's precision; Z when timeZone is set), and INTERVAL (ISO-8601 duration). An UNKNOWN column's values are NULL. A non-null value of a type the service cannot return fails the request with ValidationException (cast the column to VARCHAR).
    • fromBlobValue

      public static SqlValue fromBlobValue(SdkBytes blobValue)
      Create an instance of this class with blobValue() initialized to the given value.

      A VARBINARY column value, as binary data.

      Parameters:
      blobValue - A VARBINARY column value, as binary data.
    • fromJsonValue

      public static SqlValue fromJsonValue(String jsonValue)
      Create an instance of this class with jsonValue() initialized to the given value.

      An ARRAY, STRUCT, or MAP column value, as JSON text: an array, an object, and an array of {"key": ..., "value": ...} entries. Nested values follow the same rules, with NULL as null.

      Parameters:
      jsonValue - An ARRAY, STRUCT, or MAP column value, as JSON text: an array, an object, and an array of {"key": ..., "value": ...} entries. Nested values follow the same rules, with NULL as null.
    • type

      public SqlValue.Type type()
      Retrieve an enum value representing which member of this object is populated. When this class is returned in a service response, this will be SqlValue.Type.UNKNOWN_TO_SDK_VERSION if the service returned a member that is only known to a newer SDK version. When this class is created directly in your code, this will be SqlValue.Type.UNKNOWN_TO_SDK_VERSION if zero members are set, and null if more than one member is set.
    • sdkFields

      public final List<SdkField<?>> sdkFields()
      Specified by:
      sdkFields in interface SdkPojo
      Returns:
      List of SdkField in this POJO. May be empty list but should never be null.
    • sdkFieldNameToField

      public final Map<String,SdkField<?>> sdkFieldNameToField()
      Specified by:
      sdkFieldNameToField in interface SdkPojo
      Returns:
      The mapping between the field name and its corresponding field.