Package com.clickhouse.data.value
Class ClickHouseStringValue
java.lang.Object
com.clickhouse.data.value.ClickHouseStringValue
- All Implemented Interfaces:
ClickHouseValue,Serializable
Wrapper class of
String.- See Also:
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedClickHouseStringValue(byte[] bytes) protectedClickHouseStringValue(String value) -
Method Summary
Modifier and TypeMethodDescriptionasBigDecimal(int scale) Gets value asBigDecimal.Gets value asBigInteger.byte[]asBinary()Gets binary value as byte array.byte[]Gets binary value as byte array.booleanGets value as boolean.byteasByte()Gets value as byte.charGets value as character.asDate()Gets value asLocalDate.asDateTime(int scale) Gets value asLocalDateTime.doubleasDouble()Gets value as double.<T extends Enum<T>>
TGets value as enum.floatasFloat()Gets value as float.Gets value asInet4Address.Gets value asInet6Address.intGets value as integer.longasLong()Gets value as long.asObject()Gets value as an object.Gets raw value as an object.shortasShort()Gets value as short.asString()Gets value as unbounded string, using default charset(usually UTF-8).asTime()Gets value asLocalTime.asUuid()Gets value as UUID.copy(boolean deep) Gets a copy of this value object.booleaninthashCode()booleanisBinary()booleanChecks if the value is null, or empty for non-null types like Array, Tuple and Map.static ClickHouseStringValueof(byte[] bytes) Wrap the given value.static ClickHouseStringValueof(ClickHouseValue ref, byte[] bytes) Update value of the given object or create a new instance ifrefis null.static ClickHouseStringValueof(ClickHouseValue ref, String value) Update value of the given object or create a new instance ifrefis null.static ClickHouseStringValueWrap 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.Resets to default value of corresponding data type.Resets value to null, or empty when null is not supported(e.g.protected ClickHouseStringValueset(byte[] bytes) protected ClickHouseStringValueConverts the value to escaped SQL expression.toString()update(boolean value) Updates value.update(byte value) Updates value.update(byte[] value) Updates value.update(char value) Updates value.update(double value) Updates value.update(float value) Updates value.update(int value) Updates value.update(long value) Updates value.update(short value) Updates value.update(ClickHouseValue value) Updates value.Updates value.Updates value.Updates value.update(BigDecimal value) Updates value.update(BigInteger value) Updates value.update(Inet4Address value) Updates value.update(Inet6Address value) Updates value.Updates value.update(LocalDateTime value) Updates value.Updates value.Updates value.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.clickhouse.data.ClickHouseValue
asArray, asArray, asBigDecimal, asBinary, asBinary, asByteStream, asCharacterStream, asDateTime, asInstant, asInstant, asMap, asMap, asObject, asOffsetDateTime, asOffsetDateTime, asTime, asTuple, asZonedDateTime, asZonedDateTime, copy, isInfinity, isNaN, isNullable, newUnsupportedException, update, update, update, update, update, update, update, update, update, update, update, update, update, update, update, update, updateUnknown
-
Constructor Details
-
ClickHouseStringValue
-
ClickHouseStringValue
protected ClickHouseStringValue(byte[] bytes)
-
-
Method Details
-
ofNull
Create a new instance representing null value.- Returns:
- new instance representing null value
-
ofNull
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
Wrap the given value.- Parameters:
value- value- Returns:
- object representing the value
-
of
Wrap the given value.- Parameters:
bytes- bytes- Returns:
- object representing the value
-
of
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
-
of
Update value of the given object or create a new instance ifrefis null.- Parameters:
ref- object to update, could be nullbytes- bytes- Returns:
- same object as
refor a new instance if it's null
-
set
-
set
-
copy
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
-
isBinary
public boolean isBinary() -
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
-
asCharacter
public char asCharacter()Description copied from interface:ClickHouseValueGets value as character.- Specified by:
asCharacterin interfaceClickHouseValue- Returns:
- character 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
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
Description copied from interface:ClickHouseValueGets value asBigDecimal.- Specified by:
asBigDecimalin interfaceClickHouseValue- Parameters:
scale- scale of the decimal- Returns:
- big decimal, could be null
-
asDate
Description copied from interface:ClickHouseValueGets value asLocalDate.- Specified by:
asDatein interfaceClickHouseValue- Returns:
- date, could be null
-
asTime
Description copied from interface:ClickHouseValueGets value asLocalTime.- Specified by:
asTimein interfaceClickHouseValue- Returns:
- time, could be null
-
asDateTime
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
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
Description copied from interface:ClickHouseValueGets value asInet4Address.- Specified by:
asInet4Addressin interfaceClickHouseValue- Returns:
- IPv4 address, could be null
-
asInet6Address
Description copied from interface:ClickHouseValueGets value asInet6Address.- Specified by:
asInet6Addressin interfaceClickHouseValue- Returns:
- IPv6 address, could be null
-
asObject
Description copied from interface:ClickHouseValueGets value as an object.- Specified by:
asObjectin interfaceClickHouseValue- Returns:
- an object representing the value, could be null
-
asRawObject
Description copied from interface:ClickHouseValueGets raw value as an object. This method is probably only useful forStringas it can be either a byte array or text.- Specified by:
asRawObjectin interfaceClickHouseValue- Returns:
- an object representing the raw value, could be null
-
asBinary
public byte[] asBinary()Description copied from interface:ClickHouseValueGets binary value as byte array.- Specified by:
asBinaryin interfaceClickHouseValue- Returns:
- byte array which could be null
-
asBinary
Description copied from interface:ClickHouseValueGets binary value as byte array.- Specified by:
asBinaryin interfaceClickHouseValue- Parameters:
length- byte length of value, 0 or negative number means no limitcharset- charset, null is same as default(UTF-8)- Returns:
- byte array which could be null
-
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
-
asUuid
Description copied from interface:ClickHouseValueGets value as UUID.- Specified by:
asUuidin interfaceClickHouseValue- Returns:
- uuid, could be null
-
resetToDefault
Description copied from interface:ClickHouseValueResets to default value of corresponding data type.- Specified by:
resetToDefaultin interfaceClickHouseValue- Returns:
- this object
-
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
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
Description copied from interface:ClickHouseValueUpdates value.- Specified by:
updatein interfaceClickHouseValue- Parameters:
value- value to update- Returns:
- this object
-
update
Description copied from interface:ClickHouseValueUpdates value.- Specified by:
updatein interfaceClickHouseValue- Parameters:
value- value to update- Returns:
- this object
-
update
Description copied from interface:ClickHouseValueUpdates value.- Specified by:
updatein interfaceClickHouseValue- Parameters:
value- value to update- Returns:
- this object
-
update
Description copied from interface:ClickHouseValueUpdates value.- Specified by:
updatein interfaceClickHouseValue- Parameters:
value- value to update- Returns:
- this object
-
update
Description copied from interface:ClickHouseValueUpdates value.- Specified by:
updatein interfaceClickHouseValue- Parameters:
value- value to update- Returns:
- this object
-
update
Description copied from interface:ClickHouseValueUpdates value.- Specified by:
updatein interfaceClickHouseValue- Parameters:
value- value to update- Returns:
- this object
-
update
Description copied from interface:ClickHouseValueUpdates value.- Specified by:
updatein interfaceClickHouseValue- Parameters:
value- value to update- Returns:
- this object
-
update
Description copied from interface:ClickHouseValueUpdates value.- Specified by:
updatein interfaceClickHouseValue- Parameters:
value- value to update- Returns:
- this object
-
update
Description copied from interface:ClickHouseValueUpdates value.- Specified by:
updatein interfaceClickHouseValue- Parameters:
value- value to update- Returns:
- this object
-
update
Description copied from interface:ClickHouseValueUpdates value.- Specified by:
updatein interfaceClickHouseValue- Parameters:
value- value to update- Returns:
- this object
-
update
Description copied from interface:ClickHouseValueUpdates value.- Specified by:
updatein interfaceClickHouseValue- Parameters:
value- value to update- Returns:
- this object
-
update
Description copied from interface:ClickHouseValueUpdates value.- Specified by:
updatein interfaceClickHouseValue- Parameters:
value- value to update- Returns:
- this object
-
update
Description copied from interface:ClickHouseValueUpdates value.- Specified by:
updatein interfaceClickHouseValue- Parameters:
value- value to update- Returns:
- this object
-
update
Description copied from interface:ClickHouseValueUpdates value.- Specified by:
updatein interfaceClickHouseValue- Parameters:
value- value to update- Returns:
- this object
-
update
Description copied from interface:ClickHouseValueUpdates value.- Specified by:
updatein interfaceClickHouseValue- Parameters:
value- value to update- Returns:
- this object
-
update
Description copied from interface:ClickHouseValueUpdates value.- Specified by:
updatein interfaceClickHouseValue- Parameters:
value- value to update- Returns:
- this object
-
update
Description copied from interface:ClickHouseValueUpdates value.- Specified by:
updatein interfaceClickHouseValue- Parameters:
value- value to update- Returns:
- this object
-
update
Description copied from interface:ClickHouseValueUpdates value.- Specified by:
updatein interfaceClickHouseValue- Parameters:
value- value to update- Returns:
- this object
-
update
Description copied from interface:ClickHouseValueUpdates value.- Specified by:
updatein interfaceClickHouseValue- Parameters:
value- value to update- Returns:
- this object
-
update
Description copied from interface:ClickHouseValueUpdates value.- Specified by:
updatein interfaceClickHouseValue- Parameters:
value- value to update- Returns:
- this object
-
update
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
-
hashCode
public int hashCode() -
equals
-
toString
-