Class ClickHouseObjectValue<T>

java.lang.Object
com.clickhouse.data.value.ClickHouseObjectValue<T>
All Implemented Interfaces:
ClickHouseValue, Serializable
Direct Known Subclasses:
ClickHouseArrayValue, ClickHouseBigDecimalValue, ClickHouseBigIntegerValue, ClickHouseBitmapValue, ClickHouseDateTimeValue, ClickHouseDateValue, ClickHouseGeoMultiPolygonValue, ClickHouseGeoPointValue, ClickHouseGeoPolygonValue, ClickHouseGeoRingValue, ClickHouseInstantValue, ClickHouseIpv4Value, ClickHouseIpv6Value, ClickHouseMapValue, ClickHouseNestedValue, ClickHouseOffsetDateTimeValue, ClickHouseTupleValue, ClickHouseUuidValue

public abstract class ClickHouseObjectValue<T> extends Object implements ClickHouseValue
See Also:
  • Constructor Details

    • ClickHouseObjectValue

      protected ClickHouseObjectValue(T value)
  • Method Details

    • set

      protected ClickHouseObjectValue<T> set(T value)
    • getValue

      public final T getValue()
      Gets value.
      Returns:
      value
    • isNullOrEmpty

      public boolean isNullOrEmpty()
      Description copied from interface: ClickHouseValue
      Checks if the value is null, or empty for non-null types like Array, Tuple and Map.

      Please pay attention that only nullability will be considered for String, meaning this method will return false for an empty string. This is because String is treated as value-based type instead of a container like Array.

      Specified by:
      isNullOrEmpty in interface ClickHouseValue
      Returns:
      true if the value is null or empty; false otherwise
    • asByte

      public byte asByte()
      Description copied from interface: ClickHouseValue
      Gets value as byte.
      Specified by:
      asByte in interface ClickHouseValue
      Returns:
      byte value
    • asShort

      public short asShort()
      Description copied from interface: ClickHouseValue
      Gets value as short.
      Specified by:
      asShort in interface ClickHouseValue
      Returns:
      short value
    • asInteger

      public int asInteger()
      Description copied from interface: ClickHouseValue
      Gets value as integer.
      Specified by:
      asInteger in interface ClickHouseValue
      Returns:
      integer value
    • asLong

      public long asLong()
      Description copied from interface: ClickHouseValue
      Gets value as long.
      Specified by:
      asLong in interface ClickHouseValue
      Returns:
      long value
    • asBigInteger

      public BigInteger asBigInteger()
      Description copied from interface: ClickHouseValue
      Gets value as BigInteger.
      Specified by:
      asBigInteger in interface ClickHouseValue
      Returns:
      big integer, could be null
    • asFloat

      public float asFloat()
      Description copied from interface: ClickHouseValue
      Gets value as float.
      Specified by:
      asFloat in interface ClickHouseValue
      Returns:
      float value
    • asDouble

      public double asDouble()
      Description copied from interface: ClickHouseValue
      Gets value as double.
      Specified by:
      asDouble in interface ClickHouseValue
      Returns:
      double value
    • asBigDecimal

      public BigDecimal asBigDecimal(int scale)
      Description copied from interface: ClickHouseValue
      Gets value as BigDecimal.
      Specified by:
      asBigDecimal in interface ClickHouseValue
      Parameters:
      scale - scale of the decimal
      Returns:
      big decimal, could be null
    • asObject

      public Object asObject()
      Description copied from interface: ClickHouseValue
      Gets value as an object.
      Specified by:
      asObject in interface ClickHouseValue
      Returns:
      an object representing the value, could be null
    • asString

      public String asString()
      Description copied from interface: ClickHouseValue
      Gets value as unbounded string, using default charset(usually UTF-8).
      Specified by:
      asString in interface ClickHouseValue
      Returns:
      string value, could be null
    • resetToNullOrEmpty

      public ClickHouseObjectValue<T> resetToNullOrEmpty()
      Description copied from interface: ClickHouseValue
      Resets value to null, or empty when null is not supported(e.g. Array, Tuple and Map etc.).

      Keep in mind that String is value-based type, so this method will change its value to null instead of an empty string.

      Specified by:
      resetToNullOrEmpty in interface ClickHouseValue
      Returns:
      this object
    • toSqlExpression

      public String toSqlExpression()
      Description copied from interface: ClickHouseValue
      Converts the value to escaped SQL expression. For example, number 123 will be converted to 123, while string "12'3" will be converted to @{code '12\'3'}.
      Specified by:
      toSqlExpression in interface ClickHouseValue
      Returns:
      escaped SQL expression
    • update

      public ClickHouseValue update(Object value)
      Description copied from interface: ClickHouseValue
      Updates value. This method tries to identify type of value and then use corresponding update method to proceed. Unknown value will be passed to ClickHouseValue.updateUnknown(Object).
      Specified by:
      update in interface ClickHouseValue
      Parameters:
      value - value to update, could be null
      Returns:
      this object
    • 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