Package com.clickhouse.data.value
Class ClickHouseArrayValue<T>
java.lang.Object
com.clickhouse.data.value.ClickHouseObjectValue<T[]>
com.clickhouse.data.value.ClickHouseArrayValue<T>
- All Implemented Interfaces:
ClickHouseArraySequence,ClickHouseValue,Serializable
public class ClickHouseArrayValue<T>
extends ClickHouseObjectValue<T[]>
implements ClickHouseArraySequence
Wrapper class of Array.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAllocates an array according to given arguments.Object[]asArray()Gets value as an object array.<E> E[]Gets value as an array.<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.boolean<V extends ClickHouseValue>
VgetValue(int index, V value) Gets value at the specified position in this array.inthashCode()booleanChecks whether the value is nullable.booleanChecks if the value is null, or empty for non-null types like Array, Tuple and Map.intlength()Gets length of this array.static <T> ClickHouseArrayValue<T>of(ClickHouseValue ref, T[] value) Update value of the given object or create a new instance ifrefis null.static <T> ClickHouseArrayValue<T>of(T[] value) Wrap the given value.static <T> ClickHouseArrayValue<T>ofEmpty()Creates an empty array.static <T> ClickHouseArrayValue<T>Creates an empty array.Resets to default value of corresponding data type.Resets value to null, or empty when null is not supported(e.g.protected ClickHouseArrayValue<T>setValue(int index, ClickHouseValue value) Sets value to the specified position in this array.Converts the value to escaped SQL expression.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(double[] value) Updates value.update(float value) Updates value.update(float[] value) Updates value.update(int value) Updates value.update(int[] value) Updates value.update(long value) Updates value.update(long[] value) Updates value.update(short value) Updates value.update(short[] value) Updates value.update(ClickHouseValue value) Updates 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.update(Collection<?> value) Updates value.update(Enumeration<?> 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, getValue, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.clickhouse.data.ClickHouseArraySequence
allocate, allocate, copyMethods inherited from interface com.clickhouse.data.ClickHouseValue
asBigDecimal, asBigDecimal, asBigInteger, asBinary, asBinary, asBinary, asBinary, asBoolean, asByte, asByteStream, asCharacter, asCharacterStream, asDate, asDateTime, asDateTime, asDouble, asEnum, asFloat, asInet4Address, asInet6Address, asInstant, asInstant, asInteger, asLong, asMap, asObject, asObject, asOffsetDateTime, asOffsetDateTime, asRawObject, asShort, asTime, asTime, asTuple, asUuid, asZonedDateTime, asZonedDateTime, isInfinity, isNaN, newUnsupportedException, update, update, update, update, update, update, update
-
Constructor Details
-
ClickHouseArrayValue
-
-
Method Details
-
ofEmpty
Creates an empty array.- Type Parameters:
T- type of the array- Returns:
- empty array
-
ofEmpty
Creates an empty array.- Type Parameters:
T- type of the array- Parameters:
clazz- non-null component class- Returns:
- empty array
-
of
Wrap the given value.- Type Parameters:
T- type of element- Parameters:
value- value- Returns:
- object representing the value
-
of
Update value of the given object or create a new instance ifrefis null.- Type Parameters:
T- type of element- Parameters:
ref- object to update, could be nullvalue- value- Returns:
- same object as
refor a new instance if it's null
-
set
- Overrides:
setin classClickHouseObjectValue<T[]>
-
asArray
Description copied from interface:ClickHouseValueGets value as an object array.- Specified by:
asArrayin interfaceClickHouseValue- Returns:
- non-null object array
-
asArray
Description copied from interface:ClickHouseValueGets value as an array.- Specified by:
asArrayin interfaceClickHouseValue- Type Parameters:
E- type of the element- Parameters:
clazz- class of the element- Returns:
- non-null array
-
asMap
Description copied from interface:ClickHouseValueGets value as a map.- Specified by:
asMapin interfaceClickHouseValue- 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<T[]>- Returns:
- string value, could be null
-
copy
Description copied from interface:ClickHouseValueGets a copy of this value object.- Specified by:
copyin interfaceClickHouseArraySequence- Specified by:
copyin interfaceClickHouseValue- Parameters:
deep- true to create a deep copy; false for a shallow copy- Returns:
- copy of this value object
-
isNullable
public boolean isNullable()Description copied from interface:ClickHouseValueChecks whether the value is nullable. This always returnsfalsefor nested value type.- Specified by:
isNullablein interfaceClickHouseValue- Returns:
- true if the value is nullable; false otherwise
-
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<T[]>- Returns:
- true if the value is null or empty; false otherwise
-
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- Overrides:
resetToNullOrEmptyin classClickHouseObjectValue<T[]>- 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<T[]>- 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.- 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
-
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.- Specified by:
updateUnknownin 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- Overrides:
updatein classClickHouseObjectValue<T[]>- Parameters:
value- value to update, could be null- Returns:
- this object
-
equals
- Overrides:
equalsin classClickHouseObjectValue<T[]>
-
hashCode
public int hashCode()- Overrides:
hashCodein classClickHouseObjectValue<T[]>
-
allocate
Description copied from interface:ClickHouseArraySequenceAllocates an array according to given arguments. Pay attention that this will will not create new array but reuse existing one, whenlengthareclazznot changed.- Specified by:
allocatein interfaceClickHouseArraySequence- Parameters:
length- length of the arrayclazz- optional value type, null meansObject.classlevel- level of the array, zero or negative number is treated as1- Returns:
- this value
-
length
public int length()Description copied from interface:ClickHouseArraySequenceGets length of this array.- Specified by:
lengthin interfaceClickHouseArraySequence- Returns:
- length of this array
-
getValue
Description copied from interface:ClickHouseArraySequenceGets value at the specified position in this array.- Specified by:
getValuein interfaceClickHouseArraySequence- Type Parameters:
V- type of the value- Parameters:
index- index which is greater than or equal to zero and it's always smaller thanClickHouseArraySequence.length()value- non-null template object to retrieve the value- Returns:
- non-null value which is same as
value
-
setValue
Description copied from interface:ClickHouseArraySequenceSets value to the specified position in this array.- Specified by:
setValuein interfaceClickHouseArraySequence- Parameters:
index- index which is greater than or equal to zero and it's always smaller thanClickHouseArraySequence.length()value- non-null container of the value- Returns:
- this value
-