Interface SettableByNameData<T extends SettableData<T>>
-
- All Known Subinterfaces:
SettableData<T>
- All Known Implementing Classes:
UDTValue
public interface SettableByNameData<T extends SettableData<T>>Collection of (typed) CQL values that can set by name.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <V> Tset(java.lang.String name, V v, com.google.common.reflect.TypeToken<V> targetType)Sets the value for (all occurrences of) variablenameto the provided value of the provided Java type.<V> Tset(java.lang.String name, V v, java.lang.Class<V> targetClass)Sets the value for (all occurrences of) variablenameto the provided value of the provided Java class.<V> Tset(java.lang.String name, V v, TypeCodec<V> codec)Sets the value for (all occurrences of) variablenameto the provided value, converted using the givenTypeCodec.TsetBool(java.lang.String name, boolean v)Sets the value for (all occurrences of) variablenameto the provided boolean.TsetByte(java.lang.String name, byte v)Sets the value for (all occurrences of) variablenameto the provided byte.TsetBytes(java.lang.String name, java.nio.ByteBuffer v)Sets the value for (all occurrences of) variablenameto the provided byte buffer.TsetBytesUnsafe(java.lang.String name, java.nio.ByteBuffer v)Sets the value for (all occurrences of) variablenameto the provided byte buffer.TsetDate(java.lang.String name, LocalDate v)Sets the value for (all occurrences of) variablenameto the provided date (without time).TsetDecimal(java.lang.String name, java.math.BigDecimal v)Sets the value for (all occurrences of) variablenameto the provided big decimal.TsetDouble(java.lang.String name, double v)Sets the value for (all occurrences of) variablenameto the provided double.TsetFloat(java.lang.String name, float v)Sets the value for (all occurrences of) variablenameto the provided float.TsetInet(java.lang.String name, java.net.InetAddress v)Sets the value for (all occurrences of) variablenameto the provided inet address.TsetInt(java.lang.String name, int v)Sets the value for (all occurrences of) variablenameto the provided integer.<E> TsetList(java.lang.String name, java.util.List<E> v)Sets the value for (all occurrences of) variablenameto the provided list.<E> TsetList(java.lang.String name, java.util.List<E> v, com.google.common.reflect.TypeToken<E> elementsType)Sets the value for (all occurrences of) variablenameto the provided list, which elements are of the provided Java type.<E> TsetList(java.lang.String name, java.util.List<E> v, java.lang.Class<E> elementsClass)Sets the value for (all occurrences of) variablenameto the provided list, which elements are of the provided Java class.TsetLong(java.lang.String name, long v)Sets the value for (all occurrences of) variablenameto the provided long.<K,V>
TsetMap(java.lang.String name, java.util.Map<K,V> v)Sets the value for (all occurrences of) variablenameto the provided map.<K,V>
TsetMap(java.lang.String name, java.util.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) variablenameto the provided map, which keys and values are of the provided Java types.<K,V>
TsetMap(java.lang.String name, java.util.Map<K,V> v, java.lang.Class<K> keysClass, java.lang.Class<V> valuesClass)Sets the value for (all occurrences of) variablenameto the provided map, which keys and values are of the provided Java classes.<E> TsetSet(java.lang.String name, java.util.Set<E> v)Sets the value for (all occurrences of) variablenameto the provided set.<E> TsetSet(java.lang.String name, java.util.Set<E> v, com.google.common.reflect.TypeToken<E> elementsType)Sets the value for (all occurrences of) variablenameto the provided set, which elements are of the provided Java type.<E> TsetSet(java.lang.String name, java.util.Set<E> v, java.lang.Class<E> elementsClass)Sets the value for (all occurrences of) variablenameto the provided set, which elements are of the provided Java class.TsetShort(java.lang.String name, short v)Sets the value for (all occurrences of) variablenameto the provided short.TsetString(java.lang.String name, java.lang.String v)Sets the value for (all occurrences of) variablenameto the provided string.TsetTime(java.lang.String name, long v)Sets the value for (all occurrences of) variablenameto the provided time as a long in nanoseconds since midnight.TsetTimestamp(java.lang.String name, java.util.Date v)Sets the value for (all occurrences of) variablenameto the provided date.TsetToNull(java.lang.String name)Sets the value for (all occurrences of) variablenametonull.TsetTupleValue(java.lang.String name, TupleValue v)Sets the value for (all occurrences of) variablenameto the provided tuple value.TsetUDTValue(java.lang.String name, UDTValue v)Sets the value for (all occurrences of) variablenameto the provided UDT value.TsetUUID(java.lang.String name, java.util.UUID v)Sets the value for (all occurrences of) variablenameto the provided UUID.TsetVarint(java.lang.String name, java.math.BigInteger v)Sets the value for (all occurrences of) variablenameto the provided big integer.
-
-
-
Method Detail
-
setBool
T setBool(java.lang.String name, boolean v)
Sets the value for (all occurrences of) variablenameto the provided boolean.This method uses the
CodecRegistryto find a codec to handle the conversion to the underlying CQL type (for CQL typeboolean, this will be the built-in codec).- Parameters:
name- the name of the value to set; ifnameis present multiple times, all its values are set.v- the value to set. To set the value to NULL, usesetToNull(String)orset(name, v, Boolean.class).- Returns:
- this object.
- Throws:
java.lang.IllegalArgumentException- ifnameis not a valid name for this object.CodecNotFoundException- if there is no registered codec to convert the value to the underlying CQL type.
-
setByte
T setByte(java.lang.String name, byte v)
Sets the value for (all occurrences of) variablenameto the provided byte.This method uses the
CodecRegistryto find a codec to handle the conversion to the underlying CQL type (for CQL typetinyint, this will be the built-in codec).- Parameters:
name- the name of the value to set; ifnameis present multiple times, all its values are set.v- the value to set. To set the value to NULL, usesetToNull(String)orset(name, v, Byte.class).- Returns:
- this object.
- Throws:
java.lang.IllegalArgumentException- ifnameis not a valid name for this object.CodecNotFoundException- if there is no registered codec to convert the value to the underlying CQL type.
-
setShort
T setShort(java.lang.String name, short v)
Sets the value for (all occurrences of) variablenameto the provided short.This method uses the
CodecRegistryto find a codec to handle the conversion to the underlying CQL type (for CQL typesmallint, this will be the built-in codec).- Parameters:
name- the name of the value to set; ifnameis present multiple times, all its values are set.v- the value to set. To set the value to NULL, usesetToNull(String)orset(name, v, Short.class).- Returns:
- this object.
- Throws:
java.lang.IllegalArgumentException- ifnameis not a valid name for this object.CodecNotFoundException- if there is no registered codec to convert the value to the underlying CQL type.
-
setInt
T setInt(java.lang.String name, int v)
Sets the value for (all occurrences of) variablenameto the provided integer.This method uses the
CodecRegistryto find a codec to handle the conversion to the underlying CQL type (for CQL typeint, this will be the built-in codec).- Parameters:
name- the name of the value to set; ifnameis present multiple times, all its values are set.v- the value to set. To set the value to NULL, usesetToNull(String)orset(name, v, Integer.class).- Returns:
- this object.
- Throws:
java.lang.IllegalArgumentException- ifnameis not a valid name for this object.CodecNotFoundException- if there is no registered codec to convert the value to the underlying CQL type.
-
setLong
T setLong(java.lang.String name, long v)
Sets the value for (all occurrences of) variablenameto the provided long.This method uses the
CodecRegistryto find a codec to handle the conversion to the underlying CQL type (for CQL typebigint, this will be the built-in codec).- Parameters:
name- the name of the value to set; ifnameis present multiple times, all its values are set.v- the value to set. To set the value to NULL, usesetToNull(String)orset(name, v, Long.class).- Returns:
- this object.
- Throws:
java.lang.IllegalArgumentException- ifnameis not a valid name for this object.CodecNotFoundException- if there is no registered codec to convert the value to the underlying CQL type.
-
setTimestamp
T setTimestamp(java.lang.String name, java.util.Date v)
Sets the value for (all occurrences of) variablenameto the provided date.This method uses the
CodecRegistryto find a codec to handle the conversion to the underlying CQL type (for CQL typetimestamp, this will be the built-in codec).- Parameters:
name- the name of the value to set; ifnameis present multiple times, all its values are set.v- the value to set.- Returns:
- this object.
- Throws:
java.lang.IllegalArgumentException- ifnameis not a valid name for this object.CodecNotFoundException- if there is no registered codec to convert the value to the underlying CQL type.
-
setDate
T setDate(java.lang.String name, LocalDate v)
Sets the value for (all occurrences of) variablenameto the provided date (without time).This method uses the
CodecRegistryto find a codec to handle the conversion to the underlying CQL type (for CQL typedate, this will be the built-in codec).- Parameters:
name- the name of the value to set; ifnameis present multiple times, all its values are set.v- the value to set.- Returns:
- this object.
- Throws:
java.lang.IllegalArgumentException- ifnameis not a valid name for this object.CodecNotFoundException- if there is no registered codec to convert the value to the underlying CQL type.
-
setTime
T setTime(java.lang.String name, long v)
Sets the value for (all occurrences of) variablenameto the provided time as a long in nanoseconds since midnight.This method uses the
CodecRegistryto find a codec to handle the conversion to the underlying CQL type (for CQL typetime, this will be the built-in codec).- Parameters:
name- the name of the value to set; ifnameis present multiple times, all its values are set.v- the value to set.- Returns:
- this object.
- Throws:
java.lang.IllegalArgumentException- ifnameis not a valid name for this object.CodecNotFoundException- if there is no registered codec to convert the value to the underlying CQL type.
-
setFloat
T setFloat(java.lang.String name, float v)
Sets the value for (all occurrences of) variablenameto the provided float.This method uses the
CodecRegistryto find a codec to handle the conversion to the underlying CQL type (for CQL typefloat, this will be the built-in codec).- Parameters:
name- the name of the value to set; ifnameis present multiple times, all its values are set.v- the value to set. To set the value to NULL, usesetToNull(String)orset(name, v, Float.class).- Returns:
- this object.
- Throws:
java.lang.IllegalArgumentException- ifnameis not a valid name for this object.CodecNotFoundException- if there is no registered codec to convert the value to the underlying CQL type.
-
setDouble
T setDouble(java.lang.String name, double v)
Sets the value for (all occurrences of) variablenameto the provided double.This method uses the
CodecRegistryto find a codec to handle the conversion to the underlying CQL type (for CQL typedouble, this will be the built-in codec).- Parameters:
name- the name of the value to set; ifnameis present multiple times, all its values are set.v- the value to set. To set the value to NULL, usesetToNull(String)orset(name, v, Double.class).- Returns:
- this object.
- Throws:
java.lang.IllegalArgumentException- ifnameis not a valid name for this object.CodecNotFoundException- if there is no registered codec to convert the value to the underlying CQL type.
-
setString
T setString(java.lang.String name, java.lang.String v)
Sets the value for (all occurrences of) variablenameto the provided string.This method uses the
CodecRegistryto find a codec to handle the conversion to the underlying CQL type (for CQL typestext,varcharandascii, this will be the built-in codec).- Parameters:
name- the name of the value to set; ifnameis present multiple times, all its values are set.v- the value to set.- Returns:
- this object.
- Throws:
java.lang.IllegalArgumentException- ifnameis not a valid name for this object.CodecNotFoundException- if there is no registered codec to convert the value to the underlying CQL type.
-
setBytes
T setBytes(java.lang.String name, java.nio.ByteBuffer v)
Sets the value for (all occurrences of) variablenameto the provided byte buffer.This method uses the
CodecRegistryto find a codec to handle the conversion to the underlying CQL type (for CQL typeblob, this will be the built-in codec).- Parameters:
name- the name of the value to set; ifnameis present multiple times, all its values are set.v- the value to set.- Returns:
- this object.
- Throws:
java.lang.IllegalArgumentException- ifnameis not a valid name for this object.CodecNotFoundException- if there is no registered codec to convert the value to the underlying CQL type.
-
setBytesUnsafe
T setBytesUnsafe(java.lang.String name, java.nio.ByteBuffer v)
Sets the value for (all occurrences of) variablenameto 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
InvalidQueryExceptionat execute time.- Parameters:
name- the name of the value to set; ifnameis present multiple times, all its values are set.v- the value to set.- Returns:
- this object.
- Throws:
java.lang.IllegalArgumentException- ifnameis not a valid name for this object.
-
setVarint
T setVarint(java.lang.String name, java.math.BigInteger v)
Sets the value for (all occurrences of) variablenameto the provided big integer.This method uses the
CodecRegistryto find a codec to handle the conversion to the underlying CQL type (for CQL typevarint, this will be the built-in codec).- Parameters:
name- the name of the value to set; ifnameis present multiple times, all its values are set.v- the value to set.- Returns:
- this object.
- Throws:
java.lang.IllegalArgumentException- ifnameis not a valid name for this object.CodecNotFoundException- if there is no registered codec to convert the value to the underlying CQL type.
-
setDecimal
T setDecimal(java.lang.String name, java.math.BigDecimal v)
Sets the value for (all occurrences of) variablenameto the provided big decimal.This method uses the
CodecRegistryto find a codec to handle the conversion to the underlying CQL type (for CQL typedecimal, this will be the built-in codec).- Parameters:
name- the name of the value to set; ifnameis present multiple times, all its values are set.v- the value to set.- Returns:
- this object.
- Throws:
java.lang.IllegalArgumentException- ifnameis not a valid name for this object.CodecNotFoundException- if there is no registered codec to convert the value to the underlying CQL type.
-
setUUID
T setUUID(java.lang.String name, java.util.UUID v)
Sets the value for (all occurrences of) variablenameto the provided UUID.This method uses the
CodecRegistryto find a codec to handle the conversion to the underlying CQL type (for CQL typesuuidandtimeuuid, this will be the built-in codec).- Parameters:
name- the name of the value to set; ifnameis present multiple times, all its values are set.v- the value to set.- Returns:
- this object.
- Throws:
java.lang.IllegalArgumentException- ifnameis not a valid name for this object.CodecNotFoundException- if there is no registered codec to convert the value to the underlying CQL type.
-
setInet
T setInet(java.lang.String name, java.net.InetAddress v)
Sets the value for (all occurrences of) variablenameto the provided inet address.This method uses the
CodecRegistryto find a codec to handle the conversion to the underlying CQL type (for CQL typeinet, this will be the built-in codec).- Parameters:
name- the name of the value to set; ifnameis present multiple times, all its values are set.v- the value to set.- Returns:
- this object.
- Throws:
java.lang.IllegalArgumentException- ifnameis not a valid name for this object.CodecNotFoundException- if there is no registered codec to convert the value to the underlying CQL type.
-
setList
<E> T setList(java.lang.String name, java.util.List<E> v)
Sets the value for (all occurrences of) variablenameto the provided list.This method uses the
CodecRegistryto 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 methodssetList(String, List, Class)orsetList(String, List, TypeToken).- Parameters:
name- the name of the value to set; ifnameis present multiple times, all its values are set.v- the value to set. Note thatnullvalues inside collections are not supported by CQL.- Returns:
- this object.
- Throws:
java.lang.IllegalArgumentException- ifnameis not a valid name for this object.java.lang.NullPointerException- ifvcontains 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.
-
setList
<E> T setList(java.lang.String name, java.util.List<E> v, java.lang.Class<E> elementsClass)
Sets the value for (all occurrences of) variablenameto the provided list, which elements are of the provided Java class.This method uses the
CodecRegistryto 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).- Parameters:
name- the name of the value to set; ifnameis present multiplev- the value to set. Note thatnullvalues inside collections are not supported by CQL.elementsClass- the class for the elements of the list.- Returns:
- this object.
- Throws:
java.lang.IllegalArgumentException- ifnameis not a valid name for this object.java.lang.NullPointerException- ifvcontains 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.
-
setList
<E> T setList(java.lang.String name, java.util.List<E> v, com.google.common.reflect.TypeToken<E> elementsType)
Sets the value for (all occurrences of) variablenameto the provided list, which elements are of the provided Java type.This method uses the
CodecRegistryto find a codec to handle the conversion of lists of the given Java type to the underlying CQL type.- Parameters:
name- the name of the value to set; ifnameis present multiplev- the value to set. Note thatnullvalues inside collections are not supported by CQL.elementsType- the type for the elements of the list.- Returns:
- this object.
- Throws:
java.lang.IllegalArgumentException- ifnameis not a valid name for this object.java.lang.NullPointerException- ifvcontains 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.
-
setMap
<K,V> T setMap(java.lang.String name, java.util.Map<K,V> v)
Sets the value for (all occurrences of) variablenameto the provided map.This method uses the
CodecRegistryto 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 methodssetMap(String, Map, Class, Class)orsetMap(String, Map, TypeToken, TypeToken).- Parameters:
name- the name of the value to set; ifnameis present multiple times, all its values are set.v- the value to set. Note thatnullvalues inside collections are not supported by CQL.- Returns:
- this object.
- Throws:
java.lang.IllegalArgumentException- ifnameis not a valid name for this object.java.lang.NullPointerException- ifvcontains 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.
-
setMap
<K,V> T setMap(java.lang.String name, java.util.Map<K,V> v, java.lang.Class<K> keysClass, java.lang.Class<V> valuesClass)
Sets the value for (all occurrences of) variablenameto the provided map, which keys and values are of the provided Java classes.This method uses the
CodecRegistryto 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).- Parameters:
name- the name of the value to set; ifnameis present multiple times, all its values are set.v- the value to set. Note thatnullvalues 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.- Returns:
- this object.
- Throws:
java.lang.IllegalArgumentException- ifnameis not a valid name for this object.java.lang.NullPointerException- ifvcontains 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.
-
setMap
<K,V> T setMap(java.lang.String name, java.util.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) variablenameto the provided map, which keys and values are of the provided Java types.This method uses the
CodecRegistryto find a codec to handle the conversion of lists of the given Java types to the underlying CQL type.- Parameters:
name- the name of the value to set; ifnameis present multiple times, all its values are set.v- the value to set. Note thatnullvalues 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.- Returns:
- this object.
- Throws:
java.lang.IllegalArgumentException- ifnameis not a valid name for this object.java.lang.NullPointerException- ifvcontains 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.
-
setSet
<E> T setSet(java.lang.String name, java.util.Set<E> v)
Sets the value for (all occurrences of) variablenameto the provided set.This method uses the
CodecRegistryto 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 methodssetSet(String, Set, Class)orsetSet(String, Set, TypeToken).- Parameters:
name- the name of the value to set; ifnameis present multiple times, all its values are set.v- the value to set. Note thatnullvalues inside collections are not supported by CQL.- Returns:
- this object.
- Throws:
java.lang.IllegalArgumentException- ifnameis not a valid name for this object.java.lang.NullPointerException- ifvcontains 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.
-
setSet
<E> T setSet(java.lang.String name, java.util.Set<E> v, java.lang.Class<E> elementsClass)
Sets the value for (all occurrences of) variablenameto the provided set, which elements are of the provided Java class.This method uses the
CodecRegistryto 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).- Parameters:
name- the name of the value to set; ifnameis present multiplev- the value to set. Note thatnullvalues inside collections are not supported by CQL.elementsClass- the class for the elements of the set.- Returns:
- this object.
- Throws:
java.lang.IllegalArgumentException- ifnameis not a valid name for this object.java.lang.NullPointerException- ifvcontains 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.
-
setSet
<E> T setSet(java.lang.String name, java.util.Set<E> v, com.google.common.reflect.TypeToken<E> elementsType)
Sets the value for (all occurrences of) variablenameto the provided set, which elements are of the provided Java type.This method uses the
CodecRegistryto find a codec to handle the conversion of sets of the given Java type to the underlying CQL type.- Parameters:
name- the name of the value to set; ifnameis present multiplev- the value to set. Note thatnullvalues inside collections are not supported by CQL.elementsType- the type for the elements of the set.- Returns:
- this object.
- Throws:
java.lang.IllegalArgumentException- ifnameis not a valid name for this object.java.lang.NullPointerException- ifvcontains 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.
-
setUDTValue
T setUDTValue(java.lang.String name, UDTValue v)
Sets the value for (all occurrences of) variablenameto the provided UDT value.This method uses the
CodecRegistryto find a codec to handle the conversion ofUDTValueto the underlying CQL type.- Parameters:
name- the name of the value to set; ifnameis present multiple times, all its values are set.v- the value to set.- Returns:
- this object.
- Throws:
java.lang.IllegalArgumentException- ifnameis not a valid name for this object.CodecNotFoundException- if there is no registered codec to convert the value to the underlying CQL type.
-
setTupleValue
T setTupleValue(java.lang.String name, TupleValue v)
Sets the value for (all occurrences of) variablenameto the provided tuple value.This method uses the
CodecRegistryto find a codec to handle the conversion ofTupleValueto the underlying CQL type.- Parameters:
name- the name of the value to set; ifnameis present multiple times, all its values are set.v- the value to set.- Returns:
- this object.
- Throws:
java.lang.IllegalArgumentException- ifnameis not a valid name for this object.CodecNotFoundException- if there is no registered codec to convert the value to the underlying CQL type.
-
setToNull
T setToNull(java.lang.String name)
Sets the value for (all occurrences of) variablenametonull.This is mainly intended for CQL types which map to native Java types.
- Parameters:
name- the name of the value to set; ifnameis present multiple times, all its values are set.- Returns:
- this object.
- Throws:
java.lang.IllegalArgumentException- ifnameis not a valid name for this object.
-
set
<V> T set(java.lang.String name, V v, java.lang.Class<V> targetClass)
Sets the value for (all occurrences of) variablenameto the provided value of the provided Java class.This method uses the
CodecRegistryto 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.- Parameters:
name- the name of the value to set; ifnameis present multiple times, all its values are set.v- the value to set; may benull.targetClass- The Java class to convert to; must not benull;- Returns:
- this object.
- Throws:
java.lang.IllegalArgumentException- ifnameis not a valid name for this object.CodecNotFoundException- if there is no registered codec to convert the value to the underlying CQL type.
-
set
<V> T set(java.lang.String name, V v, com.google.common.reflect.TypeToken<V> targetType)
Sets the value for (all occurrences of) variablenameto the provided value of the provided Java type.This method uses the
CodecRegistryto find a codec to handle the conversion of the provided Java type to the underlying CQL type.- Parameters:
name- the name of the value to set; ifnameis present multiple times, all its values are set.v- the value to set; may benull.targetType- The Java type to convert to; must not benull;- Returns:
- this object.
- Throws:
java.lang.IllegalArgumentException- ifnameis not a valid name for this object.CodecNotFoundException- if there is no registered codec to convert the value to the underlying CQL type.
-
set
<V> T set(java.lang.String name, V v, TypeCodec<V> codec)
Sets the value for (all occurrences of) variablenameto the provided value, converted using the givenTypeCodec.This method entirely bypasses the
CodecRegistryand 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
acceptsthe underlying CQL type; failing to do so may result inInvalidTypeExceptions being thrown.- Parameters:
name- the name of the value to set; ifnameis present multiple times, all its values are set.v- the value to set; may benull.codec- TheTypeCodecto use to serialize the value; may not benull.- Returns:
- this object.
- Throws:
InvalidTypeException- if the given codec does notacceptthe underlying CQL type.java.lang.IllegalArgumentException- ifnameis not a valid name for this object.
-
-