public interface SettableByNameData<T extends SettableData<T>>
Modifier and Type | Method and Description |
---|---|
<V> T |
set(String name,
V v,
Class<V> targetClass)
Sets the value for (all occurrences of) variable
name to the provided value of the provided Java class. |
<V> T |
set(String name,
V v,
TypeCodec<V> codec)
Sets the value for (all occurrences of) variable
name to the provided value,
converted using the given TypeCodec . |
<V> T |
set(String name,
V v,
com.google.common.reflect.TypeToken<V> targetType)
Sets the value for (all occurrences of) variable
name to the provided value of the provided Java type. |
T |
setBool(String name,
boolean v)
Sets the value for (all occurrences of) variable
name to the
provided boolean. |
T |
setByte(String name,
byte v)
Sets the value for (all occurrences of) variable
name to the
provided byte. |
T |
setBytes(String name,
ByteBuffer v)
Sets the value for (all occurrences of) variable
name to the
provided byte buffer. |
T |
setBytesUnsafe(String name,
ByteBuffer v)
Sets the value for (all occurrences of) variable
name to the
provided byte buffer. |
T |
setDate(String name,
LocalDate v)
Sets the value for (all occurrences of) variable
name to the
provided date (without time). |
T |
setDecimal(String name,
BigDecimal v)
Sets the value for (all occurrences of) variable
name to the
provided big decimal. |
T |
setDouble(String name,
double v)
Sets the value for (all occurrences of) variable
name to the
provided double. |
T |
setFloat(String name,
float v)
Sets the value for (all occurrences of) variable
name to the
provided float. |
T |
setInet(String name,
InetAddress v)
Sets the value for (all occurrences of) variable
name to the
provided inet address. |
T |
setInt(String name,
int v)
Sets the value for (all occurrences of) variable
name to the
provided integer. |
<E> T |
setList(String name,
List<E> v)
Sets the value for (all occurrences of) variable
name to the
provided list. |
<E> T |
setList(String name,
List<E> v,
Class<E> elementsClass)
Sets the value for (all occurrences of) variable
name to the provided list,
which elements are of the provided Java class. |
<E> T |
setList(String name,
List<E> v,
com.google.common.reflect.TypeToken<E> elementsType)
Sets the value for (all occurrences of) variable
name to the provided list,
which elements are of the provided Java type. |
T |
setLong(String name,
long v)
Sets the value for (all occurrences of) variable
name to the
provided long. |
<K,V> T |
setMap(String name,
Map<K,V> v)
Sets the value for (all occurrences of) variable
name to the
provided map. |
<K,V> T |
setMap(String name,
Map<K,V> v,
Class<K> keysClass,
Class<V> valuesClass)
Sets the value for (all occurrences of) variable
name to the provided map,
which keys and values are of the provided Java classes. |
<K,V> T |
setMap(String name,
Map<K,V> v,
com.google.common.reflect.TypeToken<K> keysType,
com.google.common.reflect.TypeToken<V> valuesType)
Sets the value for (all occurrences of) variable
name to the provided map,
which keys and values are of the provided Java types. |
<E> T |
setSet(String name,
Set<E> v)
Sets the value for (all occurrences of) variable
name to the
provided set. |
<E> T |
setSet(String name,
Set<E> v,
Class<E> elementsClass)
Sets the value for (all occurrences of) variable
name to the provided set,
which elements are of the provided Java class. |
<E> T |
setSet(String name,
Set<E> v,
com.google.common.reflect.TypeToken<E> elementsType)
Sets the value for (all occurrences of) variable
name to the provided set,
which elements are of the provided Java type. |
T |
setShort(String name,
short v)
Sets the value for (all occurrences of) variable
name to the
provided short. |
T |
setString(String name,
String v)
Sets the value for (all occurrences of) variable
name to the
provided string. |
T |
setTime(String name,
long v)
Sets the value for (all occurrences of) variable
name to the
provided time as a long in nanoseconds since midnight. |
T |
setTimestamp(String name,
Date v)
Sets the value for (all occurrences of) variable
name to the
provided date. |
T |
setToNull(String name)
Sets the value for (all occurrences of) variable
name to null . |
T |
setTupleValue(String name,
TupleValue v)
Sets the value for (all occurrences of) variable
name to the
provided tuple value. |
T |
setUDTValue(String name,
UDTValue v)
Sets the value for (all occurrences of) variable
name to the
provided UDT value. |
T |
setUUID(String name,
UUID v)
Sets the value for (all occurrences of) variable
name to the
provided UUID. |
T |
setVarint(String name,
BigInteger v)
Sets the value for (all occurrences of) variable
name to the
provided big integer. |
T setBool(String name, boolean v)
name
to the
provided boolean.
This method uses the CodecRegistry
to find a codec to handle the conversion
to the underlying CQL type (for CQL type boolean
, this will be the built-in codec).
name
- the name of the value to set; if name
is present multiple
times, all its values are set.v
- the value to set. To set the value to NULL, use setToNull(String)
or
set(name, v, Boolean.class)
.IllegalArgumentException
- if name
is not a valid name for this object.CodecNotFoundException
- if there is no registered codec to convert the value to the
underlying CQL type.T setByte(String name, byte v)
name
to the
provided byte.
This method uses the CodecRegistry
to find a codec to handle the conversion
to the underlying CQL type (for CQL type tinyint
, this will be the built-in codec).
name
- the name of the value to set; if name
is present multiple
times, all its values are set.v
- the value to set. To set the value to NULL, use setToNull(String)
or
set(name, v, Byte.class)
.IllegalArgumentException
- if name
is not a valid name for this object.CodecNotFoundException
- if there is no registered codec to convert the value to the
underlying CQL type.T setShort(String name, short v)
name
to the
provided short.
This method uses the CodecRegistry
to find a codec to handle the conversion
to the underlying CQL type (for CQL type smallint
, this will be the built-in codec).
name
- the name of the value to set; if name
is present multiple
times, all its values are set.v
- the value to set. To set the value to NULL, use setToNull(String)
or
set(name, v, Short.class)
.IllegalArgumentException
- if name
is not a valid name for this object.CodecNotFoundException
- if there is no registered codec to convert the value to the
underlying CQL type.T setInt(String name, int v)
name
to the
provided integer.
This method uses the CodecRegistry
to find a codec to handle the conversion
to the underlying CQL type (for CQL type int
, this will be the built-in codec).
name
- the name of the value to set; if name
is present multiple
times, all its values are set.v
- the value to set. To set the value to NULL, use setToNull(String)
or
set(name, v, Integer.class)
.IllegalArgumentException
- if name
is not a valid name for this object.CodecNotFoundException
- if there is no registered codec to convert the value to the
underlying CQL type.T setLong(String name, long v)
name
to the
provided long.
This method uses the CodecRegistry
to find a codec to handle the conversion
to the underlying CQL type (for CQL type bigint
, this will be the built-in codec).
name
- the name of the value to set; if name
is present multiple
times, all its values are set.v
- the value to set. To set the value to NULL, use setToNull(String)
or
set(name, v, Long.class)
.IllegalArgumentException
- if name
is not a valid name for this object.CodecNotFoundException
- if there is no registered codec to convert the value to the
underlying CQL type.T setTimestamp(String name, Date v)
name
to the
provided date.
This method uses the CodecRegistry
to find a codec to handle the conversion
to the underlying CQL type (for CQL type timestamp
, this will be the built-in codec).
name
- the name of the value to set; if name
is present multiple
times, all its values are set.v
- the value to set.IllegalArgumentException
- if name
is not a valid name for this object.CodecNotFoundException
- if there is no registered codec to convert the value to the
underlying CQL type.T setDate(String name, LocalDate v)
name
to the
provided date (without time).
This method uses the CodecRegistry
to find a codec to handle the conversion
to the underlying CQL type (for CQL type date
, this will be the built-in codec).
name
- the name of the value to set; if name
is present multiple
times, all its values are set.v
- the value to set.IllegalArgumentException
- if name
is not a valid name for this object.CodecNotFoundException
- if there is no registered codec to convert the value to the
underlying CQL type.T setTime(String name, long v)
name
to the
provided time as a long in nanoseconds since midnight.
This method uses the CodecRegistry
to find a codec to handle the conversion
to the underlying CQL type (for CQL type time
, this will be the built-in codec).
name
- the name of the value to set; if name
is present multiple
times, all its values are set.v
- the value to set.IllegalArgumentException
- if name
is not a valid name for this object.CodecNotFoundException
- if there is no registered codec to convert the value to the
underlying CQL type.T setFloat(String name, float v)
name
to the
provided float.
This method uses the CodecRegistry
to find a codec to handle the conversion
to the underlying CQL type (for CQL type float
, this will be the built-in codec).
name
- the name of the value to set; if name
is present multiple
times, all its values are set.v
- the value to set. To set the value to NULL, use setToNull(String)
or
set(name, v, Float.class)
.IllegalArgumentException
- if name
is not a valid name for this object.CodecNotFoundException
- if there is no registered codec to convert the value to the
underlying CQL type.T setDouble(String name, double v)
name
to the
provided double.
This method uses the CodecRegistry
to find a codec to handle the conversion
to the underlying CQL type (for CQL type double
, this will be the built-in codec).
name
- the name of the value to set; if name
is present multiple
times, all its values are set.v
- the value to set. To set the value to NULL, use setToNull(String)
or
set(name, v, Double.class)
.IllegalArgumentException
- if name
is not a valid name for this object.CodecNotFoundException
- if there is no registered codec to convert the value to the
underlying CQL type.T setString(String name, String v)
name
to the
provided string.
This method uses the CodecRegistry
to find a codec to handle the conversion
to the underlying CQL type (for CQL types text
, varchar
and ascii
,
this will be the built-in codec).
name
- the name of the value to set; if name
is present multiple
times, all its values are set.v
- the value to set.IllegalArgumentException
- if name
is not a valid name for this object.CodecNotFoundException
- if there is no registered codec to convert the value to the
underlying CQL type.T setBytes(String name, ByteBuffer v)
name
to the
provided byte buffer.
This method uses the CodecRegistry
to find a codec to handle the conversion
to the underlying CQL type (for CQL type blob
, this will be the built-in codec).
name
- the name of the value to set; if name
is present multiple
times, all its values are set.v
- the value to set.IllegalArgumentException
- if name
is not a valid name for this object.CodecNotFoundException
- if there is no registered codec to convert the value to the
underlying CQL type.T setBytesUnsafe(String name, ByteBuffer v)
name
to the
provided byte buffer.
This method does not use any codec; it sets the value in its binary form directly. If you insert
data that is not compatible with the underlying CQL type, you will get an InvalidQueryException
at
execute time.
name
- the name of the value to set; if name
is present multiple
times, all its values are set.v
- the value to set.IllegalArgumentException
- if name
is not a valid name for this object.T setVarint(String name, BigInteger v)
name
to the
provided big integer.
This method uses the CodecRegistry
to find a codec to handle the conversion
to the underlying CQL type (for CQL type varint
, this will be the built-in codec).
name
- the name of the value to set; if name
is present multiple
times, all its values are set.v
- the value to set.IllegalArgumentException
- if name
is not a valid name for this object.CodecNotFoundException
- if there is no registered codec to convert the value to the
underlying CQL type.T setDecimal(String name, BigDecimal v)
name
to the
provided big decimal.
This method uses the CodecRegistry
to find a codec to handle the conversion
to the underlying CQL type (for CQL type decimal
, this will be the built-in codec).
name
- the name of the value to set; if name
is present multiple
times, all its values are set.v
- the value to set.IllegalArgumentException
- if name
is not a valid name for this object.CodecNotFoundException
- if there is no registered codec to convert the value to the
underlying CQL type.T setUUID(String name, UUID v)
name
to the
provided UUID.
This method uses the CodecRegistry
to find a codec to handle the conversion
to the underlying CQL type (for CQL types uuid
and timeuuid
, this will
be the built-in codec).
name
- the name of the value to set; if name
is present multiple
times, all its values are set.v
- the value to set.IllegalArgumentException
- if name
is not a valid name for this object.CodecNotFoundException
- if there is no registered codec to convert the value to the
underlying CQL type.T setInet(String name, InetAddress v)
name
to the
provided inet address.
This method uses the CodecRegistry
to find a codec to handle the conversion
to the underlying CQL type (for CQL type inet
, this will be the built-in codec).
name
- the name of the value to set; if name
is present multiple
times, all its values are set.v
- the value to set.IllegalArgumentException
- if name
is not a valid name for this object.CodecNotFoundException
- if there is no registered codec to convert the value to the
underlying CQL type.<E> T setList(String name, List<E> v)
name
to the
provided list.
This method uses the CodecRegistry
to find a codec to handle the conversion
to the underlying CQL type (the type of the elements in the Java list is not considered).
If two or more codecs target that CQL type, the one that was first registered will be used.
For this reason, it is generally preferable to use the more deterministic methods
setList(String, List, Class)
or setList(String, List, TypeToken)
.
name
- the name of the value to set; if name
is present multiple
times, all its values are set.v
- the value to set. Note that null
values inside collections are not supported by CQL.IllegalArgumentException
- if name
is not a valid name for this object.NullPointerException
- if v
contains null values. Nulls are not supported in collections
by CQL.CodecNotFoundException
- if there is no registered codec to convert the value to the
underlying CQL type.<E> T setList(String name, List<E> v, Class<E> elementsClass)
name
to the provided list,
which elements are of the provided Java class.
This method uses the CodecRegistry
to find a codec to handle the conversion of lists of the given
Java type to the underlying CQL type.
If the type of the elements is generic, use setList(String, List, TypeToken)
.
name
- the name of the value to set; if name
is present multiplev
- the value to set. Note that null
values inside collections are not supported by CQL.elementsClass
- the class for the elements of the list.IllegalArgumentException
- if name
is not a valid name for this object.NullPointerException
- if v
contains null values. Nulls are not supported in collections
by CQL.CodecNotFoundException
- if there is no registered codec to convert the value to the
underlying CQL type.<E> T setList(String name, List<E> v, com.google.common.reflect.TypeToken<E> elementsType)
name
to the provided list,
which elements are of the provided Java type.
This method uses the CodecRegistry
to find a codec to handle the conversion of lists of the given
Java type to the underlying CQL type.
name
- the name of the value to set; if name
is present multiplev
- the value to set. Note that null
values inside collections are not supported by CQL.elementsType
- the type for the elements of the list.IllegalArgumentException
- if name
is not a valid name for this object.NullPointerException
- if v
contains null values. Nulls are not supported in collections
by CQL.CodecNotFoundException
- if there is no registered codec to convert the value to the
underlying CQL type.<K,V> T setMap(String name, Map<K,V> v)
name
to the
provided map.
This method uses the CodecRegistry
to find a codec to handle the conversion
to the underlying CQL type (the type of the elements in the Java map is not considered).
If two or more codecs target that CQL type, the one that was first registered will be used.
For this reason, it is generally preferable to use the more deterministic methods
setMap(String, Map, Class, Class)
or setMap(String, Map, TypeToken, TypeToken)
.
name
- the name of the value to set; if name
is present multiple
times, all its values are set.v
- the value to set. Note that null
values inside collections are not supported by CQL.IllegalArgumentException
- if name
is not a valid name for this object.NullPointerException
- if v
contains null values. Nulls are not supported in collections
by CQL.CodecNotFoundException
- if there is no registered codec to convert the value to the
underlying CQL type.<K,V> T setMap(String name, Map<K,V> v, Class<K> keysClass, Class<V> valuesClass)
name
to the provided map,
which keys and values are of the provided Java classes.
This method uses the CodecRegistry
to find a codec to handle the conversion of lists of the given
Java types to the underlying CQL type.
If the type of the keys or values is generic, use setMap(String, Map, TypeToken, TypeToken)
.
name
- the name of the value to set; if name
is present multiple
times, all its values are set.v
- the value to set. Note that null
values inside collections are not supported by CQL.keysClass
- the class for the keys of the map.valuesClass
- the class for the values of the map.IllegalArgumentException
- if name
is not a valid name for this object.NullPointerException
- if v
contains null values. Nulls are not supported in collections
by CQL.CodecNotFoundException
- if there is no registered codec to convert the value to the
underlying CQL type.<K,V> T setMap(String name, Map<K,V> v, com.google.common.reflect.TypeToken<K> keysType, com.google.common.reflect.TypeToken<V> valuesType)
name
to the provided map,
which keys and values are of the provided Java types.
This method uses the CodecRegistry
to find a codec to handle the conversion of lists of the given
Java types to the underlying CQL type.
name
- the name of the value to set; if name
is present multiple
times, all its values are set.v
- the value to set. Note that null
values inside collections are not supported by CQL.keysType
- the type for the keys of the map.valuesType
- the type for the values of the map.IllegalArgumentException
- if name
is not a valid name for this object.NullPointerException
- if v
contains null values. Nulls are not supported in collections
by CQL.CodecNotFoundException
- if there is no registered codec to convert the value to the
underlying CQL type.<E> T setSet(String name, Set<E> v)
name
to the
provided set.
This method uses the CodecRegistry
to find a codec to handle the conversion
to the underlying CQL type (the type of the elements in the Java set is not considered).
If two or more codecs target that CQL type, the one that was first registered will be used.
For this reason, it is generally preferable to use the more deterministic methods
setSet(String, Set, Class)
or setSet(String, Set, TypeToken)
.
name
- the name of the value to set; if name
is present multiple
times, all its values are set.v
- the value to set. Note that null
values inside collections are not supported by CQL.IllegalArgumentException
- if name
is not a valid name for this object.NullPointerException
- if v
contains null values. Nulls are not supported in collections
by CQL.CodecNotFoundException
- if there is no registered codec to convert the value to the
underlying CQL type.<E> T setSet(String name, Set<E> v, Class<E> elementsClass)
name
to the provided set,
which elements are of the provided Java class.
This method uses the CodecRegistry
to find a codec to handle the conversion of sets of the given
Java type to the underlying CQL type.
If the type of the elements is generic, use setSet(String, Set, TypeToken)
.
name
- the name of the value to set; if name
is present multiplev
- the value to set. Note that null
values inside collections are not supported by CQL.elementsClass
- the class for the elements of the set.IllegalArgumentException
- if name
is not a valid name for this object.NullPointerException
- if v
contains null values. Nulls are not supported in collections
by CQL.CodecNotFoundException
- if there is no registered codec to convert the value to the
underlying CQL type.<E> T setSet(String name, Set<E> v, com.google.common.reflect.TypeToken<E> elementsType)
name
to the provided set,
which elements are of the provided Java type.
This method uses the CodecRegistry
to find a codec to handle the conversion of sets of the given
Java type to the underlying CQL type.
name
- the name of the value to set; if name
is present multiplev
- the value to set. Note that null
values inside collections are not supported by CQL.elementsType
- the type for the elements of the set.IllegalArgumentException
- if name
is not a valid name for this object.NullPointerException
- if v
contains null values. Nulls are not supported in collections
by CQL.CodecNotFoundException
- if there is no registered codec to convert the value to the
underlying CQL type.T setUDTValue(String name, UDTValue v)
name
to the
provided UDT value.
This method uses the CodecRegistry
to find a codec to handle the conversion of UDTValue
to the underlying CQL type.
name
- the name of the value to set; if name
is present multiple
times, all its values are set.v
- the value to set.IllegalArgumentException
- if name
is not a valid name for this object.CodecNotFoundException
- if there is no registered codec to convert the value to the
underlying CQL type.T setTupleValue(String name, TupleValue v)
name
to the
provided tuple value.
This method uses the CodecRegistry
to find a codec to handle the conversion of TupleValue
to the underlying CQL type.
name
- the name of the value to set; if name
is present multiple
times, all its values are set.v
- the value to set.IllegalArgumentException
- if name
is not a valid name for this object.CodecNotFoundException
- if there is no registered codec to convert the value to the
underlying CQL type.T setToNull(String name)
name
to null
.
This is mainly intended for CQL types which map to native Java types.
name
- the name of the value to set; if name
is present multiple
times, all its values are set.IllegalArgumentException
- if name
is not a valid name for this object.<V> T set(String name, V v, Class<V> targetClass)
name
to the provided value of the provided Java class.
This method uses the CodecRegistry
to find a codec to handle the conversion of the provided Java class
to the underlying CQL type.
If the Java type is generic, use set(String, Object, TypeToken)
instead.
name
- the name of the value to set; if name
is present multiple
times, all its values are set.v
- the value to set; may be null
.targetClass
- The Java class to convert to; must not be null
;IllegalArgumentException
- if name
is not a valid name for this object.CodecNotFoundException
- if there is no registered codec to convert the value to the
underlying CQL type.<V> T set(String name, V v, com.google.common.reflect.TypeToken<V> targetType)
name
to the provided value of the provided Java type.
This method uses the CodecRegistry
to find a codec to handle the conversion of the provided Java type
to the underlying CQL type.
name
- the name of the value to set; if name
is present multiple
times, all its values are set.v
- the value to set; may be null
.targetType
- The Java type to convert to; must not be null
;IllegalArgumentException
- if name
is not a valid name for this object.CodecNotFoundException
- if there is no registered codec to convert the value to the
underlying CQL type.<V> T set(String name, V v, TypeCodec<V> codec)
name
to the provided value,
converted using the given TypeCodec
.
This method entirely bypasses the CodecRegistry
and forces the driver to use the given codec instead.
This can be useful if the codec would collide with a previously registered one, or if you want to use the
codec just once without registering it.
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.
name
- the name of the value to set; if name
is present multiple
times, all its values are 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.IllegalArgumentException
- if name
is not a valid name for this object.Copyright © 2012–2015. All rights reserved.