Class ClickHouseObjectValue<T>

    • Constructor Detail

      • ClickHouseObjectValue

        protected ClickHouseObjectValue​(T value)
    • Method Detail

      • getValue

        public 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
      • 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​(int length,
                               Charset charset)
        Description copied from interface: ClickHouseValue
        Gets value as fixed length(in bytes) string.
        Specified by:
        asString in interface ClickHouseValue
        Parameters:
        length - byte length of the string, 0 or negative number means unbounded
        charset - charset, null is same as default(UTF-8)
        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
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object