Package com.clickhouse.data.value
Class ClickHouseMapValue
java.lang.Object
com.clickhouse.data.value.ClickHouseObjectValue<Map<?,?>>
com.clickhouse.data.value.ClickHouseMapValue
- All Implemented Interfaces:
ClickHouseValue,Serializable
- See Also:
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedClickHouseMapValue(Map<?, ?> value, Class<?> keyType, Class<?> valueType) -
Method Summary
Modifier and TypeMethodDescriptionasMap()Gets value as a map.<K,V> Map<K, V> Gets value as a map.asString()Gets value as unbounded string, using default charset(usually UTF-8).copy(boolean deep) Gets a copy of this value object.protected ObjectbooleanChecks if the value is null, or empty for non-null types like Array, Tuple and Map.static ClickHouseMapValueof(ClickHouseValue ref, Map<?, ?> value, Class<?> keyType, Class<?> valueType) Update value of the given object or create a new instance ifrefis null.static ClickHouseMapValueWrap the given value.static ClickHouseMapValueCreates an empty map.Resets to default value of corresponding data type.Resets value to null, or empty when null is not supported(e.g.protected ClickHouseMapValueConverts the value to escaped SQL expression.update(byte 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.Updates value.updateUnknown(Object value) Updates value when the type is not supported.Methods inherited from class com.clickhouse.data.value.ClickHouseObjectValue
asBigDecimal, asBigInteger, asByte, asDouble, asFloat, asInteger, asLong, asObject, asShort, equals, getValue, hashCode, toStringMethods 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, asBinary, asBinary, asBoolean, asByteStream, asCharacter, asCharacterStream, asDate, asDateTime, asDateTime, asEnum, asInet4Address, asInet6Address, asInstant, asInstant, asObject, asOffsetDateTime, asOffsetDateTime, asRawObject, asTime, asTime, asTuple, asUuid, asZonedDateTime, asZonedDateTime, copy, isInfinity, isNaN, isNullable, newUnsupportedException, update, update, update, update, update, update, update, update, update, update, update, update, update, update, update, update, update, update
-
Constructor Details
-
ClickHouseMapValue
-
-
Method Details
-
ofEmpty
Creates an empty map.- Parameters:
keyType- non-null class of keyvalueType- non-null class of value- Returns:
- empty map
-
of
Wrap the given value.- Parameters:
value- valuekeyType- non-null class of keyvalueType- non-null class of value- Returns:
- object representing the value
-
of
public static ClickHouseMapValue of(ClickHouseValue ref, Map<?, ?> value, Class<?> keyType, Class<?> valueType) Update value of the given object or create a new instance ifrefis null.- Parameters:
ref- object to update, could be nullvalue- valuekeyType- non-null class of keyvalueType- non-null class of value- Returns:
- same object as
refor a new instance if it's null
-
getDefaultKey
-
set
- Overrides:
setin classClickHouseObjectValue<Map<?,?>>
-
copy
Description copied from interface:ClickHouseValueGets a copy of this value object.- Parameters:
deep- true to create a deep copy; false for a shallow copy- Returns:
- copy of this value object
-
asMap
Description copied from interface:ClickHouseValueGets value as a map.- Returns:
- non-null map value
-
asMap
Description copied from interface:ClickHouseValueGets value as a map.- Type Parameters:
K- type of keyV- type of value- Parameters:
keyClass- non-null class of keyvalueClass- non-null class of value- Returns:
- non-null map value
-
asString
Description copied from interface:ClickHouseValueGets value as unbounded string, using default charset(usually UTF-8).- Specified by:
asStringin interfaceClickHouseValue- Overrides:
asStringin classClickHouseObjectValue<Map<?,?>> - Returns:
- string value, could be null
-
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- Overrides:
isNullOrEmptyin classClickHouseObjectValue<Map<?,?>> - Returns:
- true if the value is null or empty; false otherwise
-
resetToDefault
Description copied from interface:ClickHouseValueResets to default value of corresponding data type.- 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- Overrides:
resetToNullOrEmptyin classClickHouseObjectValue<Map<?,?>> - 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- Overrides:
toSqlExpressionin classClickHouseObjectValue<Map<?,?>> - Returns:
- escaped SQL expression
-
update
Description copied from interface:ClickHouseValueUpdates value.- Parameters:
value- value to update- Returns:
- this object
-
update
Description copied from interface:ClickHouseValueUpdates value.- Parameters:
value- value to update- Returns:
- this object
-
update
Description copied from interface:ClickHouseValueUpdates value.- Parameters:
value- value to update- Returns:
- this object
-
update
Description copied from interface:ClickHouseValueUpdates value.- Parameters:
value- value to update- Returns:
- this object
-
update
Description copied from interface:ClickHouseValueUpdates value.- Parameters:
value- value to update- Returns:
- this object
-
update
Description copied from interface:ClickHouseValueUpdates value.- Parameters:
value- value to update- Returns:
- this object
-
update
Description copied from interface:ClickHouseValueUpdates value.- Parameters:
value- value to update- Returns:
- this object
-
update
Description copied from interface:ClickHouseValueUpdates value.- Parameters:
value- value to update- Returns:
- this object
-
update
Description copied from interface:ClickHouseValueUpdates value.- Parameters:
value- value to update- Returns:
- this object
-
update
Description copied from interface:ClickHouseValueUpdates value.- Parameters:
value- value to update- Returns:
- this object
-
update
Description copied from interface:ClickHouseValueUpdates value.- Parameters:
value- value to update- Returns:
- this object
-
update
Description copied from interface:ClickHouseValueUpdates value.- Parameters:
value- value to update- Returns:
- this object
-
update
Description copied from interface:ClickHouseValueUpdates value.- Parameters:
value- value to update- Returns:
- this object
-
update
Description copied from interface:ClickHouseValueUpdates value.- Parameters:
value- value to update- Returns:
- this object
-
update
Description copied from interface:ClickHouseValueUpdates value.- Parameters:
value- value to update- Returns:
- this object
-
update
Description copied from interface:ClickHouseValueUpdates value.- Parameters:
value- value to update- Returns:
- this object
-
update
Description copied from interface:ClickHouseValueUpdates value.- Parameters:
value- value to update- Returns:
- this object
-
updateUnknown
Description copied from interface:ClickHouseValueUpdates value when the type is not supported. This method will be called at the end ofClickHouseValue.update(Object)after trying all known classes. By default, it's same asupdate(String.valueOf(value)).Please avoid to call
ClickHouseValue.update(Object)here as it will create endless loop.- Parameters:
value- value to update- Returns:
- this object
-
update
Description copied from interface:ClickHouseValueUpdates value.- 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- Overrides:
updatein classClickHouseObjectValue<Map<?,?>> - Parameters:
value- value to update, could be null- Returns:
- this object
-