Package com.clickhouse.client.data
Class ClickHouseStringValue
- java.lang.Object
-
- com.clickhouse.client.data.ClickHouseStringValue
-
- All Implemented Interfaces:
ClickHouseValue,Serializable
public class ClickHouseStringValue extends Object implements ClickHouseValue
Wraper class of string.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedClickHouseStringValue(String value)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description BigDecimalasBigDecimal(int scale)Gets value asBigDecimal.BigIntegerasBigInteger()Gets value asBigInteger.booleanasBoolean()Gets value as boolean.byteasByte()Gets value as byte.LocalDateasDate()Gets value asLocalDate.LocalDateTimeasDateTime(int scale)Gets value asLocalDateTime.doubleasDouble()Gets value as double.<T extends Enum<T>>
TasEnum(Class<T> enumType)Gets value as enum.floatasFloat()Gets value as float.Inet4AddressasInet4Address()Gets value asInet4Address.Inet6AddressasInet6Address()Gets value asInet6Address.intasInteger()Gets value as integer.longasLong()Gets value as long.ObjectasObject()Gets value as an object.shortasShort()Gets value as short.StringasString()Gets value as unbounded string, using default charset(usually UTF-8).StringasString(int length, Charset charset)Gets value as fixed length(in bytes) string.LocalTimeasTime()Gets value asLocalTime.UUIDasUuid()Gets value as UUID.ClickHouseStringValuecopy(boolean deep)Gets a copy of this value object.booleanequals(Object obj)StringgetValue()Gets value.inthashCode()booleanisNullOrEmpty()Checks if the value is null, or empty for non-null types like Array, Tuple and Map.static ClickHouseStringValueof(ClickHouseValue ref, String value)Update value of the given object or create a new instance ifrefis null.static ClickHouseStringValueof(String value)Wrap the given value.static ClickHouseStringValueofNull()Create a new instance representing null value.static ClickHouseStringValueofNull(ClickHouseValue ref)Update given value to null or create a new instance ifrefis null.ClickHouseStringValueresetToNullOrEmpty()Resets value to null, or empty when null is not supported(e.g.protected ClickHouseStringValueset(String value)StringtoSqlExpression()Converts the value to escaped SQL expression.StringtoString()ClickHouseStringValueupdate(boolean value)Updates value.ClickHouseStringValueupdate(byte value)Updates value.ClickHouseStringValueupdate(char value)Updates value.ClickHouseStringValueupdate(double value)Updates value.ClickHouseStringValueupdate(float value)Updates value.ClickHouseStringValueupdate(int value)Updates value.ClickHouseStringValueupdate(long value)Updates value.ClickHouseStringValueupdate(short value)Updates value.ClickHouseStringValueupdate(ClickHouseValue value)Updates value.ClickHouseStringValueupdate(Enum<?> value)Updates value.ClickHouseStringValueupdate(Object value)Updates value.ClickHouseStringValueupdate(String value)Updates value.ClickHouseValueupdate(BigDecimal value)Updates value.ClickHouseValueupdate(BigInteger value)Updates value.ClickHouseStringValueupdate(Inet4Address value)Updates value.ClickHouseStringValueupdate(Inet6Address value)Updates value.ClickHouseStringValueupdate(LocalDate value)Updates value.ClickHouseStringValueupdate(LocalDateTime value)Updates value.ClickHouseStringValueupdate(LocalTime value)Updates value.ClickHouseStringValueupdate(UUID value)Updates value.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.clickhouse.client.ClickHouseValue
asArray, asArray, asBigDecimal, asByteStream, asCharacter, asCharacterStream, asDateTime, asInstant, asInstant, asMap, asMap, asObject, asOffsetDateTime, asOffsetDateTime, asString, asString, asTime, asTuple, asZonedDateTime, asZonedDateTime, copy, isInfinity, isNaN, newUnsupportedException, update, update, update, update, update, update, update, update, update, update, update, update, update, update, update, update, update, updateUnknown
-
-
-
-
Constructor Detail
-
ClickHouseStringValue
protected ClickHouseStringValue(String value)
-
-
Method Detail
-
ofNull
public static ClickHouseStringValue ofNull()
Create a new instance representing null value.- Returns:
- new instance representing null value
-
ofNull
public static ClickHouseStringValue ofNull(ClickHouseValue ref)
Update given value to null or create a new instance ifrefis null.- Parameters:
ref- object to update, could be null- Returns:
- same object as
refor a new instance if it's null
-
of
public static ClickHouseStringValue of(String value)
Wrap the given value.- Parameters:
value- value- Returns:
- object representing the value
-
of
public static ClickHouseStringValue of(ClickHouseValue ref, String value)
Update value of the given object or create a new instance ifrefis null.- Parameters:
ref- object to update, could be nullvalue- value- Returns:
- same object as
refor a new instance if it's null
-
set
protected ClickHouseStringValue set(String value)
-
getValue
public String getValue()
Gets value.- Returns:
- value
-
copy
public ClickHouseStringValue copy(boolean deep)
Description copied from interface:ClickHouseValueGets a copy of this value object.- Specified by:
copyin interfaceClickHouseValue- Parameters:
deep- true to create a deep copy; false for a shallow copy- Returns:
- copy of this value object
-
isNullOrEmpty
public boolean isNullOrEmpty()
Description copied from interface:ClickHouseValueChecks 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
falsefor an empty string. This is because String is treated as value-based type instead of a container like Array.- Specified by:
isNullOrEmptyin interfaceClickHouseValue- Returns:
- true if the value is null or empty; false otherwise
-
asBoolean
public boolean asBoolean()
Description copied from interface:ClickHouseValueGets value as boolean.- Specified by:
asBooleanin interfaceClickHouseValue- Returns:
- boolean value
-
asByte
public byte asByte()
Description copied from interface:ClickHouseValueGets value as byte.- Specified by:
asBytein interfaceClickHouseValue- Returns:
- byte value
-
asShort
public short asShort()
Description copied from interface:ClickHouseValueGets value as short.- Specified by:
asShortin interfaceClickHouseValue- Returns:
- short value
-
asInteger
public int asInteger()
Description copied from interface:ClickHouseValueGets value as integer.- Specified by:
asIntegerin interfaceClickHouseValue- Returns:
- integer value
-
asLong
public long asLong()
Description copied from interface:ClickHouseValueGets value as long.- Specified by:
asLongin interfaceClickHouseValue- Returns:
- long value
-
asBigInteger
public BigInteger asBigInteger()
Description copied from interface:ClickHouseValueGets value asBigInteger.- Specified by:
asBigIntegerin interfaceClickHouseValue- Returns:
- big integer, could be null
-
asFloat
public float asFloat()
Description copied from interface:ClickHouseValueGets value as float.- Specified by:
asFloatin interfaceClickHouseValue- Returns:
- float value
-
asDouble
public double asDouble()
Description copied from interface:ClickHouseValueGets value as double.- Specified by:
asDoublein interfaceClickHouseValue- Returns:
- double value
-
asBigDecimal
public BigDecimal asBigDecimal(int scale)
Description copied from interface:ClickHouseValueGets value asBigDecimal.- Specified by:
asBigDecimalin interfaceClickHouseValue- Parameters:
scale- scale of the decimal- Returns:
- big decimal, could be null
-
asDate
public LocalDate asDate()
Description copied from interface:ClickHouseValueGets value asLocalDate.- Specified by:
asDatein interfaceClickHouseValue- Returns:
- date, could be null
-
asTime
public LocalTime asTime()
Description copied from interface:ClickHouseValueGets value asLocalTime.- Specified by:
asTimein interfaceClickHouseValue- Returns:
- time, could be null
-
asDateTime
public LocalDateTime asDateTime(int scale)
Description copied from interface:ClickHouseValueGets value asLocalDateTime.- Specified by:
asDateTimein interfaceClickHouseValue- Parameters:
scale- scale of the date time, between 0 (second) and 9 (nano second)- Returns:
- date time, could be null
-
asEnum
public <T extends Enum<T>> T asEnum(Class<T> enumType)
Description copied from interface:ClickHouseValueGets value as enum.- Specified by:
asEnumin interfaceClickHouseValue- Type Parameters:
T- type of the enum- Parameters:
enumType- enum class- Returns:
- enum, could be null
-
asInet4Address
public Inet4Address asInet4Address()
Description copied from interface:ClickHouseValueGets value asInet4Address.- Specified by:
asInet4Addressin interfaceClickHouseValue- Returns:
- IPv4 address, could be null
-
asInet6Address
public Inet6Address asInet6Address()
Description copied from interface:ClickHouseValueGets value asInet6Address.- Specified by:
asInet6Addressin interfaceClickHouseValue- Returns:
- IPv6 address, could be null
-
asObject
public Object asObject()
Description copied from interface:ClickHouseValueGets value as an object.- Specified by:
asObjectin interfaceClickHouseValue- Returns:
- an object representing the value, could be null
-
asString
public String asString()
Description copied from interface:ClickHouseValueGets value as unbounded string, using default charset(usually UTF-8).- Specified by:
asStringin interfaceClickHouseValue- Returns:
- string value, could be null
-
asString
public String asString(int length, Charset charset)
Description copied from interface:ClickHouseValueGets value as fixed length(in bytes) string.- Specified by:
asStringin interfaceClickHouseValue- Parameters:
length- byte length of the string, 0 or negative number means unboundedcharset- charset, null is same as default(UTF-8)- Returns:
- string value, could be null
-
asUuid
public UUID asUuid()
Description copied from interface:ClickHouseValueGets value as UUID.- Specified by:
asUuidin interfaceClickHouseValue- Returns:
- uuid, could be null
-
resetToNullOrEmpty
public ClickHouseStringValue resetToNullOrEmpty()
Description copied from interface:ClickHouseValueResets 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:
resetToNullOrEmptyin interfaceClickHouseValue- Returns:
- this object
-
toSqlExpression
public String toSqlExpression()
Description copied from interface:ClickHouseValueConverts the value to escaped SQL expression. For example, number 123 will be converted to123, while string "12'3" will be converted to @{code '12\'3'}.- Specified by:
toSqlExpressionin interfaceClickHouseValue- Returns:
- escaped SQL expression
-
update
public ClickHouseStringValue update(boolean value)
Description copied from interface:ClickHouseValueUpdates value.- Specified by:
updatein interfaceClickHouseValue- Parameters:
value- value to update- Returns:
- this object
-
update
public ClickHouseStringValue update(char value)
Description copied from interface:ClickHouseValueUpdates value.- Specified by:
updatein interfaceClickHouseValue- Parameters:
value- value to update- Returns:
- this object
-
update
public ClickHouseStringValue update(byte value)
Description copied from interface:ClickHouseValueUpdates value.- Specified by:
updatein interfaceClickHouseValue- Parameters:
value- value to update- Returns:
- this object
-
update
public ClickHouseStringValue update(short value)
Description copied from interface:ClickHouseValueUpdates value.- Specified by:
updatein interfaceClickHouseValue- Parameters:
value- value to update- Returns:
- this object
-
update
public ClickHouseStringValue update(int value)
Description copied from interface:ClickHouseValueUpdates value.- Specified by:
updatein interfaceClickHouseValue- Parameters:
value- value to update- Returns:
- this object
-
update
public ClickHouseStringValue update(long value)
Description copied from interface:ClickHouseValueUpdates value.- Specified by:
updatein interfaceClickHouseValue- Parameters:
value- value to update- Returns:
- this object
-
update
public ClickHouseStringValue update(float value)
Description copied from interface:ClickHouseValueUpdates value.- Specified by:
updatein interfaceClickHouseValue- Parameters:
value- value to update- Returns:
- this object
-
update
public ClickHouseStringValue update(double value)
Description copied from interface:ClickHouseValueUpdates value.- Specified by:
updatein interfaceClickHouseValue- Parameters:
value- value to update- Returns:
- this object
-
update
public ClickHouseValue update(BigInteger value)
Description copied from interface:ClickHouseValueUpdates value.- Specified by:
updatein interfaceClickHouseValue- Parameters:
value- value to update- Returns:
- this object
-
update
public ClickHouseValue update(BigDecimal value)
Description copied from interface:ClickHouseValueUpdates value.- Specified by:
updatein interfaceClickHouseValue- Parameters:
value- value to update- Returns:
- this object
-
update
public ClickHouseStringValue update(Enum<?> value)
Description copied from interface:ClickHouseValueUpdates value.- Specified by:
updatein interfaceClickHouseValue- Parameters:
value- value to update- Returns:
- this object
-
update
public ClickHouseStringValue update(Inet4Address value)
Description copied from interface:ClickHouseValueUpdates value.- Specified by:
updatein interfaceClickHouseValue- Parameters:
value- value to update- Returns:
- this object
-
update
public ClickHouseStringValue update(Inet6Address value)
Description copied from interface:ClickHouseValueUpdates value.- Specified by:
updatein interfaceClickHouseValue- Parameters:
value- value to update- Returns:
- this object
-
update
public ClickHouseStringValue update(LocalDate value)
Description copied from interface:ClickHouseValueUpdates value.- Specified by:
updatein interfaceClickHouseValue- Parameters:
value- value to update- Returns:
- this object
-
update
public ClickHouseStringValue update(LocalTime value)
Description copied from interface:ClickHouseValueUpdates value.- Specified by:
updatein interfaceClickHouseValue- Parameters:
value- value to update- Returns:
- this object
-
update
public ClickHouseStringValue update(LocalDateTime value)
Description copied from interface:ClickHouseValueUpdates value.- Specified by:
updatein interfaceClickHouseValue- Parameters:
value- value to update- Returns:
- this object
-
update
public ClickHouseStringValue update(String value)
Description copied from interface:ClickHouseValueUpdates value.- Specified by:
updatein interfaceClickHouseValue- Parameters:
value- value to update- Returns:
- this object
-
update
public ClickHouseStringValue update(UUID value)
Description copied from interface:ClickHouseValueUpdates value.- Specified by:
updatein interfaceClickHouseValue- Parameters:
value- value to update- Returns:
- this object
-
update
public ClickHouseStringValue update(ClickHouseValue value)
Description copied from interface:ClickHouseValueUpdates value.- Specified by:
updatein interfaceClickHouseValue- Parameters:
value- value to update- Returns:
- this object
-
update
public ClickHouseStringValue update(Object value)
Description copied from interface:ClickHouseValueUpdates value. This method tries to identify type ofvalueand then use corresponding update method to proceed. Unknown value will be passed toClickHouseValue.updateUnknown(Object).- Specified by:
updatein interfaceClickHouseValue- Parameters:
value- value to update, could be null- Returns:
- this object
-
-