public interface SettableByIndexData<T extends SettableByIndexData<T>>
Modifier and Type | Method and Description |
---|---|
<V> T |
set(int i,
V v,
Class<V> targetClass)
Sets the
i th value to the provided value of the provided Java class. |
<V> T |
set(int i,
V v,
TypeCodec<V> codec)
Sets the
i th value to the provided value, converted using the given TypeCodec . |
<V> T |
set(int i,
V v,
com.google.common.reflect.TypeToken<V> targetType)
Sets the
i th value to the provided value of the provided Java type. |
T |
setBool(int i,
boolean v)
Sets the
i th value to the provided boolean. |
T |
setByte(int i,
byte v)
Set the
i th value to the provided byte. |
T |
setBytes(int i,
ByteBuffer v)
Sets the
i th value to the provided byte buffer. |
T |
setBytesUnsafe(int i,
ByteBuffer v)
Sets the
i th value to the provided byte buffer. |
T |
setDate(int i,
LocalDate v)
Set the
i th value to the provided date (without time). |
T |
setDecimal(int i,
BigDecimal v)
Sets the
i th value to the provided big decimal. |
T |
setDouble(int i,
double v)
Sets the
i th value to the provided double. |
T |
setFloat(int i,
float v)
Sets the
i th value to the provided float. |
T |
setInet(int i,
InetAddress v)
Sets the
i th value to the provided inet address. |
T |
setInt(int i,
int v)
Set the
i th value to the provided integer. |
<E> T |
setList(int i,
List<E> v)
Sets the
i th value to the provided list. |
<E> T |
setList(int i,
List<E> v,
Class<E> elementsClass)
Sets the
i th value to the provided list, whose elements are of the provided
Java class. |
<E> T |
setList(int i,
List<E> v,
com.google.common.reflect.TypeToken<E> elementsType)
Sets the
i th value to the provided list, whose elements are of the provided
Java type. |
T |
setLong(int i,
long v)
Sets the
i th value to the provided long. |
<K,V> T |
setMap(int i,
Map<K,V> v)
Sets the
i th value to the provided map. |
<K,V> T |
setMap(int i,
Map<K,V> v,
Class<K> keysClass,
Class<V> valuesClass)
Sets the
i th value to the provided map, whose keys and values are of the provided
Java classes. |
<K,V> T |
setMap(int i,
Map<K,V> v,
com.google.common.reflect.TypeToken<K> keysType,
com.google.common.reflect.TypeToken<V> valuesType)
Sets the
i th value to the provided map, whose keys and values are of the provided
Java types. |
<V> T |
setObject(int i,
V v)
Sets the
i th value to the provided value. |
<E> T |
setSet(int i,
Set<E> v)
Sets the
i th value to the provided set. |
<E> T |
setSet(int i,
Set<E> v,
Class<E> elementsClass)
Sets the
i th value to the provided set, whose elements are of the provided
Java class. |
<E> T |
setSet(int i,
Set<E> v,
com.google.common.reflect.TypeToken<E> elementsType)
Sets the
i th value to the provided set, whose elements are of the provided
Java type. |
T |
setShort(int i,
short v)
Set the
i th value to the provided short. |
T |
setString(int i,
String v)
Sets the
i th value to the provided string. |
T |
setTime(int i,
long v)
Set the
i th value to the provided time as a long in nanoseconds since midnight. |
T |
setTimestamp(int i,
Date v)
Set the
i th value to the provided date. |
T |
setToNull(int i)
Sets the
i th value to null . |
T |
setTupleValue(int i,
TupleValue v)
Sets the
i th value to the provided tuple value. |
T |
setUDTValue(int i,
UDTValue v)
Sets the
i th value to the provided UDT value. |
T |
setUUID(int i,
UUID v)
Sets the
i th value to the provided UUID. |
T |
setVarint(int i,
BigInteger v)
Sets the
i th value to the provided big integer. |
T setBool(int i, boolean v)
i
th value to the provided boolean.i
- the index of the value to set.v
- the value to set.IndexOutOfBoundsException
- if i
is not a valid index for this object.InvalidTypeException
- if value i
is not of type BOOLEAN.T setByte(int i, byte v)
i
th value to the provided byte.i
- the index of the value to set.v
- the value to set.IndexOutOfBoundsException
- if i
is not a valid index for this object.InvalidTypeException
- if value i
is not of type TINYINT.T setShort(int i, short v)
i
th value to the provided short.i
- the index of the value to set.v
- the value to set.IndexOutOfBoundsException
- if i
is not a valid index for this object.InvalidTypeException
- if value i
is not of type SMALLINT.T setInt(int i, int v)
i
th value to the provided integer.i
- the index of the value to set.v
- the value to set.IndexOutOfBoundsException
- if i
is not a valid index for this object.InvalidTypeException
- if value i
is not of type INT.T setLong(int i, long v)
i
th value to the provided long.i
- the index of the value to set.v
- the value to set.IndexOutOfBoundsException
- if i
is not a valid index for this object.InvalidTypeException
- if value i
is not of type BIGINT or COUNTER.T setTimestamp(int i, Date v)
i
th value to the provided date.i
- the index of the value to set.v
- the value to set.IndexOutOfBoundsException
- if i
is not a valid index for this object.InvalidTypeException
- if value i
is not of type TIMESTAMP.T setDate(int i, LocalDate v)
i
th value to the provided date (without time).i
- the index of the value to set.v
- the value to set.IndexOutOfBoundsException
- if i
is not a valid index for this object.InvalidTypeException
- if value i
is not of type DATE.T setTime(int i, long v)
i
th value to the provided time as a long in nanoseconds since midnight.i
- the index of the value to set.v
- the value to set.IndexOutOfBoundsException
- if i
is not a valid index for this object.InvalidTypeException
- if value i
is not of type TIME.T setFloat(int i, float v)
i
th value to the provided float.i
- the index of the value to set.v
- the value to set.IndexOutOfBoundsException
- if i
is not a valid index for this object.InvalidTypeException
- if value i
is not of type FLOAT.T setDouble(int i, double v)
i
th value to the provided double.i
- the index of the value to set.v
- the value to set.IndexOutOfBoundsException
- if i
is not a valid index for this object.InvalidTypeException
- if value i
is not of type DOUBLE.T setString(int i, String v)
i
th value to the provided string.i
- the index of the value to set.v
- the value to set.IndexOutOfBoundsException
- if i
is not a valid index for this object.InvalidTypeException
- if value i
is of neither of the
following types: VARCHAR, TEXT or ASCII.T setBytes(int i, ByteBuffer v)
i
th value to the provided byte buffer.
This method validate that the type of the column set is BLOB. If you
want to insert manually serialized data into columns of another type,
use setBytesUnsafe(int, java.nio.ByteBuffer)
instead.i
- the index of the value to set.v
- the value to set.IndexOutOfBoundsException
- if i
is not a valid index for this object.InvalidTypeException
- if value i
is not of type BLOB.T setBytesUnsafe(int i, ByteBuffer v)
i
th value to the provided byte buffer.
Contrary to setBytes(int, java.nio.ByteBuffer)
, this method does not check the
type of the column set. If you insert data that is not compatible with
the type of the column, you will get an InvalidQueryException
at
execute time.i
- the index of the value to set.v
- the value to set.IndexOutOfBoundsException
- if i
is not a valid index for this object.T setVarint(int i, BigInteger v)
i
th value to the provided big integer.i
- the index of the value to set.v
- the value to set.IndexOutOfBoundsException
- if i
is not a valid index for this object.InvalidTypeException
- if value i
is not of type VARINT.T setDecimal(int i, BigDecimal v)
i
th value to the provided big decimal.i
- the index of the value to set.v
- the value to set.IndexOutOfBoundsException
- if i
is not a valid index for this object.InvalidTypeException
- if value i
is not of type DECIMAL.T setUUID(int i, UUID v)
i
th value to the provided UUID.i
- the index of the value to set.v
- the value to set.IndexOutOfBoundsException
- if i
is not a valid index for this object.InvalidTypeException
- if value i
is not of type UUID or
TIMEUUID, or if value i
is of type TIMEUUID but v
is
not a type 1 UUID.T setInet(int i, InetAddress v)
i
th value to the provided inet address.i
- the index of the value to set.v
- the value to set.IndexOutOfBoundsException
- if i
is not a valid index for this object.InvalidTypeException
- if value i
is not of type INET.<E> T setList(int i, List<E> v)
i
th value to the provided list.
Please note that null
values inside collections are not supported by CQL.
Note about performance: this method must perform a runtime inspection of the provided list, in order to guess the best codec to serialize the list elements.
Furthermore, if two or more codecs are available
for the underlying CQL type (list
), which one will be used will depend
on the actual object being serialized.
For these reasons, it is generally preferable to use the more
deterministic methods setList(int, List, Class)
or
setList(int, List, TypeToken)
.
i
- the index of the value to set.v
- the value to set.IndexOutOfBoundsException
- if i
is not a valid index for this object.InvalidTypeException
- if value i
is not a list type or
if the elements of v
are not of the type of the elements of
column i
.NullPointerException
- if v
contains null values. Nulls are not supported in collections
by CQL.<E> T setList(int i, List<E> v, Class<E> elementsClass)
i
th value to the provided list, whose elements are of the provided
Java class.
Please note that null
values inside collections are not supported by CQL.
Note about performance: this method is able to cache codecs used to serialize the list elements,
and thus should be used instead of setList(int, List)
whenever possible, because it performs significantly better.
i
- the index of the value to set.v
- the value to set.elementsClass
- the class for the elements of the list.IndexOutOfBoundsException
- if i
is not a valid index for this object.InvalidTypeException
- if value i
is not a list type or
if the elements of v
are not of the type of the elements of
column i
.NullPointerException
- if v
contains null values. Nulls are not supported in collections
by CQL.<E> T setList(int i, List<E> v, com.google.common.reflect.TypeToken<E> elementsType)
i
th value to the provided list, whose elements are of the provided
Java type.
Please note that null
values inside collections are not supported by CQL.
Note about performance: this method is able to cache codecs used to serialize the list elements,
and thus should be used instead of setList(int, List)
whenever possible, because it performs significantly better.
i
- the index of the value to set.v
- the value to set.elementsType
- the type for the elements of the list.IndexOutOfBoundsException
- if i
is not a valid index for this object.InvalidTypeException
- if value i
is not a list type or
if the elements of v
are not of the type of the elements of
column i
.NullPointerException
- if v
contains null values. Nulls are not supported in collections
by CQL.<K,V> T setMap(int i, Map<K,V> v)
i
th value to the provided map.
Please note that null
values are not supported inside collection by CQL.
Note about performance: this method must perform a runtime inspection of the provided map, in order to guess the best codec to serialize the map entries. The result of such inspection cannot be cached and thus must be performed for each invocation of this method, which may incur in a performance penalty.
Furthermore, if two or more codecs are available
for the underlying CQL type (map
), which one will be used will depend
on the actual object being serialized.
For these reasons, it is generally preferable to use the more
deterministic methods setMap(int, Map, Class, Class)
or
setMap(int, Map, TypeToken, TypeToken)
.
i
- the index of the value to set.v
- the value to set.IndexOutOfBoundsException
- if i
is not a valid index for this object.InvalidTypeException
- if value i
is not a map type or
if the elements (keys or values) of v
are not of the type of the
elements of column i
.NullPointerException
- if v
contains null values. Nulls are not supported in collections
by CQL.<K,V> T setMap(int i, Map<K,V> v, Class<K> keysClass, Class<V> valuesClass)
i
th value to the provided map, whose keys and values are of the provided
Java classes.
Please note that null
values inside collections are not supported by CQL.
Note about performance: this method is able to cache codecs used to serialize the map entries,
and thus should be used instead of setMap(int, Map)
whenever possible, because it performs significantly better.
i
- the index of the value to set.v
- the value to set.keysClass
- the class for the keys of the map.valuesClass
- the class for the values of the map.IndexOutOfBoundsException
- if i
is not a valid index for this object.InvalidTypeException
- if value i
is not a map type or
if the elements of v
are not of the type of the elements of
column i
.NullPointerException
- if v
contains null values. Nulls are not supported in collections
by CQL.<K,V> T setMap(int i, Map<K,V> v, com.google.common.reflect.TypeToken<K> keysType, com.google.common.reflect.TypeToken<V> valuesType)
i
th value to the provided map, whose keys and values are of the provided
Java types.
Please note that null
values inside collections are not supported by CQL.
Note about performance: this method is able to cache codecs used to serialize the map entries,
and thus should be used instead of setMap(int, Map)
whenever possible, because it performs significantly better.
i
- the index of the value to set.v
- the value to set.keysType
- the type for the keys of the map.valuesType
- the type for the values of the map.IndexOutOfBoundsException
- if i
is not a valid index for this object.InvalidTypeException
- if value i
is not a map type or
if the elements of v
are not of the type of the elements of
column i
.NullPointerException
- if v
contains null values. Nulls are not supported in collections
by CQL.<E> T setSet(int i, Set<E> v)
i
th value to the provided set.
Please note that null
values are not supported inside collection by CQL.
Note about performance: this method must perform a runtime inspection of the provided set, in order to guess the best codec to serialize the set elements. The result of such inspection cannot be cached and thus must be performed for each invocation of this method, which may incur in a performance penalty.
Furthermore, if two or more codecs are available
for the underlying CQL type (set
), which one will be used will depend
on the actual object being serialized.
For these reasons, it is generally preferable to use the more
deterministic methods setSet(int, Set, Class)
or
setSet(int, Set, TypeToken)
.
i
- the index of the value to set.v
- the value to set.IndexOutOfBoundsException
- if i
is not a valid index for this object.InvalidTypeException
- if value i
is not a set type or
if the elements of v
are not of the type of the elements of
column i
.NullPointerException
- if v
contains null values. Nulls are not supported in collections
by CQL.<E> T setSet(int i, Set<E> v, Class<E> elementsClass)
i
th value to the provided set, whose elements are of the provided
Java class.
Please note that null
values inside collections are not supported by CQL.
Note about performance: this method is able to cache codecs used to serialize the set elements,
and thus should be used instead of setSet(int, Set)
whenever possible, because it performs significantly better.
i
- the index of the value to set.v
- the value to set.elementsClass
- the class for the elements of the set.IndexOutOfBoundsException
- if i
is not a valid index for this object.InvalidTypeException
- if value i
is not a set type or
if the elements of v
are not of the type of the elements of
column i
.NullPointerException
- if v
contains null values. Nulls are not supported in collections
by CQL.<E> T setSet(int i, Set<E> v, com.google.common.reflect.TypeToken<E> elementsType)
i
th value to the provided set, whose elements are of the provided
Java type.
Please note that null
values inside collections are not supported by CQL.
Note about performance: this method is able to cache codecs used to serialize the set elements,
and thus should be used instead of setSet(int, Set)
whenever possible, because it performs significantly better.
i
- the index of the value to set.v
- the value to set.elementsType
- the type for the elements of the set.IndexOutOfBoundsException
- if i
is not a valid index for this object.InvalidTypeException
- if value i
is not a set type or
if the elements of v
are not of the type of the elements of
column i
.NullPointerException
- if v
contains null values. Nulls are not supported in collections
by CQL.T setUDTValue(int i, UDTValue v)
i
th value to the provided UDT value.i
- the index of the value to set.v
- the value to set.IndexOutOfBoundsException
- if i
is not a valid index for this object.InvalidTypeException
- if value i
is not a UDT value or if its definition
does not correspond to the one of v
.T setTupleValue(int i, TupleValue v)
i
th value to the provided tuple value.i
- the index of the value to set.v
- the value to set.IndexOutOfBoundsException
- if i
is not a valid index for this object.InvalidTypeException
- if value i
is not a tuple value or if its types
do not correspond to the ones of v
.T setToNull(int i)
i
th value to null
.
This is mainly intended for CQL types which map to native Java types.
i
- the index of the value to set.IndexOutOfBoundsException
- if i
is not a valid index for this object.<V> T setObject(int i, V v)
i
th value to the provided value.
Note about performance: this method must perform a runtime inspection of the provided object, in order to guess the best codec to serialize it. The result of such inspection cannot be cached and thus must be performed for each invocation of this method, which may incur in a performance penalty.
Furthermore, if two or more codecs are available for the underlying CQL type, which one will be used will depend on the actual object being serialized.
For these reasons, it is generally preferable to use the more
deterministic methods #set(int, V, Class)
or #set(int, V, TypeToken)
instead.
i
- the index of the value to set.v
- the value to set; may be null
.IndexOutOfBoundsException
- if i
is not a valid index for this object.<V> T set(int i, V v, Class<V> targetClass)
i
th value to the provided value of the provided Java class.
A suitable TypeCodec
instance for the underlying CQL type and the provided class must
have been previously registered with the CodecRegistry
currently in use.
This method should be used instead of setObject(int, Object)
in cases
where more than one codec is registered for the same CQL type; specifying the Java class
allows the CodecRegistry
to narrow down the search and return only an exactly-matching codec (if any),
thus avoiding any risk of ambiguity.
i
- the index of the value to set.v
- the value to set; may be null
.targetClass
- The Java class to convert to; must not be null
;IndexOutOfBoundsException
- if i
is not a valid index for this object.<V> T set(int i, V v, com.google.common.reflect.TypeToken<V> targetType)
i
th value to the provided value of the provided Java type.
A suitable TypeCodec
instance for the underlying CQL type and the provided class must
have been previously registered with the CodecRegistry
currently in use.
This method should be used instead of setObject(int, Object)
in cases
where more than one codec is registered for the same CQL type; specifying the Java class
allows the CodecRegistry
to narrow down the search and return only an exactly-matching codec (if any),
thus avoiding any risk of ambiguity.
i
- the index of the value to set.v
- the value to set; may be null
.targetType
- The Java type to convert to; must not be null
;IndexOutOfBoundsException
- if i
is not a valid index for this object.<V> T set(int i, V v, TypeCodec<V> codec)
i
th value to the provided value, converted using the given TypeCodec
.
Note that this method allows to entirely bypass the CodecRegistry
currently in use
and forces the driver to use the given codec instead.
It is the caller's responsibility to ensure that the given codec accepts
the underlying CQL type; failing to do so may result in InvalidTypeException
s being thrown.
i
- the index of the value to set.v
- the value to set; may be null
.codec
- The TypeCodec
to use to serialize the value; may not be null
.InvalidTypeException
- if the given codec does not accept
the underlying CQL type.IndexOutOfBoundsException
- if i
is not a valid index for this object.Copyright © 2012–2015. All rights reserved.