Interface SettableByName<SelfT extends SettableByName<SelfT>>
-
- All Superinterfaces:
AccessibleByIndex,AccessibleByName,Data,SettableByIndex<SelfT>
- All Known Subinterfaces:
Bindable<SelfT>,BoundStatement,UdtValue
- All Known Implementing Classes:
BoundStatementBuilder
public interface SettableByName<SelfT extends SettableByName<SelfT>> extends SettableByIndex<SelfT>, AccessibleByName
A data structure that provides methods to set its values via a name.
-
-
Method Summary
All Methods Instance Methods Default Methods Deprecated Methods Modifier and Type Method Description default DataTypegetType(String name)Returns the CQL type of the value for the first occurrence ofname.default <ValueT> SelfTset(String name, ValueT v, TypeCodec<ValueT> codec)Sets the value for all occurrences ofname, using the given codec for the conversion.default <ValueT> SelfTset(String name, ValueT v, GenericType<ValueT> targetType)Sets the value for all occurrences ofname, converting it to the given Java type.default <ValueT> SelfTset(String name, ValueT v, Class<ValueT> targetClass)Returns the value for all occurrences ofname, converting it to the given Java type.default SelfTsetBigDecimal(String name, BigDecimal v)Sets the value for all occurrences ofnameto the provided Java big decimal.default SelfTsetBigInteger(String name, BigInteger v)Sets the value for all occurrences ofnameto the provided Java big integer.default SelfTsetBool(String name, boolean v)Deprecated.this method only exists to ease the transition from driver 3, it is an alias forsetBoolean(String, boolean).default SelfTsetBoolean(String name, boolean v)Sets the value for all occurrences ofnameto the provided Java primitive boolean.default SelfTsetByte(String name, byte v)Sets the value for all occurrences ofnameto the provided Java primitive byte.default SelfTsetByteBuffer(String name, ByteBuffer v)Sets the value for all occurrences ofnameto the provided Java byte buffer.default SelfTsetBytesUnsafe(String name, ByteBuffer v)Sets the raw binary representation of the value for all occurrences ofname.default SelfTsetCqlDuration(String name, CqlDuration v)Sets the value for all occurrences ofnameto the provided duration.default SelfTsetDouble(String name, double v)Sets the value for all occurrences ofnameto the provided Java primitive double.default SelfTsetFloat(String name, float v)Sets the value for all occurrences ofnameto the provided Java primitive float.default SelfTsetInetAddress(String name, InetAddress v)Sets the value for all occurrences ofnameto the provided Java IP address.default SelfTsetInstant(String name, Instant v)Sets the value for all occurrences ofnameto the provided Java instant.default SelfTsetInt(String name, int v)Sets the value for all occurrences ofnameto the provided Java primitive integer.default <ElementT> SelfTsetList(String name, List<ElementT> v, Class<ElementT> elementsClass)Sets the value for all occurrences ofnameto the provided Java list.default SelfTsetLocalDate(String name, LocalDate v)Sets the value for all occurrences ofnameto the provided Java local date.default SelfTsetLocalTime(String name, LocalTime v)Sets the value for all occurrences ofnameto the provided Java local time.default SelfTsetLong(String name, long v)Sets the value for all occurrences ofnameto the provided Java primitive long.default <KeyT,ValueT>
SelfTsetMap(String name, Map<KeyT,ValueT> v, Class<KeyT> keyClass, Class<ValueT> valueClass)Sets the value for all occurrences ofnameto the provided Java map.default <ElementT> SelfTsetSet(String name, Set<ElementT> v, Class<ElementT> elementsClass)Sets the value for all occurrences ofnameto the provided Java set.default SelfTsetShort(String name, short v)Sets the value for all occurrences ofnameto the provided Java primitive short.default SelfTsetString(String name, String v)Sets the value for all occurrences ofnameto the provided Java string.default SelfTsetToken(String name, Token v)Sets the value for all occurrences ofnameto the provided token.default SelfTsetToNull(String name)Sets the value for all occurrences ofnameto CQLNULL.default SelfTsetTupleValue(String name, TupleValue v)Sets the value for all occurrences ofnameto the provided tuple value.default SelfTsetUdtValue(String name, UdtValue v)Sets the value for all occurrences ofnameto the provided user defined type value.default SelfTsetUuid(String name, UUID v)Sets the value for all occurrences ofnameto the provided Java UUID.default <ElementT> SelfTsetVector(String name, CqlVector<ElementT> v, Class<ElementT> elementsClass)Sets the value for all occurrences ofnameto the provided vector.-
Methods inherited from interface com.datastax.oss.driver.api.core.data.AccessibleByIndex
getType, size
-
Methods inherited from interface com.datastax.oss.driver.api.core.data.AccessibleByName
allIndicesOf, firstIndexOf
-
Methods inherited from interface com.datastax.oss.driver.api.core.data.Data
codecRegistry, protocolVersion
-
Methods inherited from interface com.datastax.oss.driver.api.core.data.SettableByIndex
set, set, set, setBigDecimal, setBigInteger, setBool, setBoolean, setByte, setByteBuffer, setBytesUnsafe, setCqlDuration, setDouble, setFloat, setInetAddress, setInstant, setInt, setList, setLocalDate, setLocalTime, setLong, setMap, setSet, setShort, setString, setToken, setToNull, setTupleValue, setUdtValue, setUuid, setVector
-
-
-
-
Method Detail
-
setBytesUnsafe
@NonNull @CheckReturnValue default SelfT setBytesUnsafe(@NonNull String name, @Nullable ByteBuffer v)
Sets the raw binary representation of the value for all occurrences ofname.This is primarily for internal use; you'll likely want to use one of the typed setters instead, to pass a higher-level Java representation.
This method deals with case sensitivity in the way explained in the documentation of
AccessibleByName.- Parameters:
v- the raw value, ornullto set the CQL valueNULL. For performance reasons, this is the actual instance used internally. If pass in a buffer that you're going to modify elsewhere in your application, make sure toduplicateit beforehand. If you change the buffer's index or its contents in any way, further usage of this data will have unpredictable results.- Throws:
IllegalArgumentException- if the name is invalid.
-
getType
@NonNull default DataType getType(@NonNull String name)
Description copied from interface:AccessibleByNameReturns the CQL type of the value for the first occurrence ofname.This method deals with case sensitivity in the way explained in the documentation of
GettableByName.- Specified by:
getTypein interfaceAccessibleByName
-
setToNull
@NonNull @CheckReturnValue default SelfT setToNull(@NonNull String name)
Sets the value for all occurrences ofnameto CQLNULL.This method deals with case sensitivity in the way explained in the documentation of
AccessibleByName.- Throws:
IllegalArgumentException- if the name is invalid.
-
set
@NonNull @CheckReturnValue default <ValueT> SelfT set(@NonNull String name, @Nullable ValueT v, @NonNull TypeCodec<ValueT> codec)
Sets the value for all occurrences ofname, using the given codec for the conversion.This method completely bypasses the
Data.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 is appropriate for the conversion. Failing to do so will result in errors at runtime.
This method deals with case sensitivity in the way explained in the documentation of
AccessibleByName.- Throws:
IllegalArgumentException- if the name is invalid.
-
set
@NonNull @CheckReturnValue default <ValueT> SelfT set(@NonNull String name, @Nullable ValueT v, @NonNull GenericType<ValueT> targetType)
Sets the value for all occurrences ofname, converting it to the given Java type.The
Data.codecRegistry()will be used to look up a codec to handle the conversion.This variant is for generic Java types. If the target type is not generic, use
SettableByIndex.set(int, Object, Class)instead, which may perform slightly better.This method deals with case sensitivity in the way explained in the documentation of
AccessibleByName.- Throws:
IllegalArgumentException- if the name is invalid.CodecNotFoundException- if no codec can perform the conversion.
-
set
@NonNull @CheckReturnValue default <ValueT> SelfT set(@NonNull String name, @Nullable ValueT v, @NonNull Class<ValueT> targetClass)
Returns the value for all occurrences ofname, converting it to the given Java type.The
Data.codecRegistry()will be used to look up a codec to handle the conversion.If the target type is generic, use
SettableByIndex.set(int, Object, GenericType)instead.This method deals with case sensitivity in the way explained in the documentation of
AccessibleByName.- Throws:
IllegalArgumentException- if the name is invalid.CodecNotFoundException- if no codec can perform the conversion.
-
setBoolean
@NonNull @CheckReturnValue default SelfT setBoolean(@NonNull String name, boolean v)
Sets the value for all occurrences ofnameto the provided Java primitive boolean.By default, this works with CQL type
boolean.To set the value to CQL
NULL, useSettableByIndex.setToNull(int), orset(i, v, Boolean.class).This method deals with case sensitivity in the way explained in the documentation of
AccessibleByName.- Throws:
IllegalArgumentException- if the name is invalid.
-
setBool
@Deprecated @NonNull @CheckReturnValue default SelfT setBool(@NonNull String name, boolean v)
Deprecated.this method only exists to ease the transition from driver 3, it is an alias forsetBoolean(String, boolean).
-
setByte
@NonNull @CheckReturnValue default SelfT setByte(@NonNull String name, byte v)
Sets the value for all occurrences ofnameto the provided Java primitive byte.By default, this works with CQL type
tinyint.To set the value to CQL
NULL, useSettableByIndex.setToNull(int), orset(i, v, Boolean.class).This method deals with case sensitivity in the way explained in the documentation of
AccessibleByName.- Throws:
IllegalArgumentException- if the name is invalid.
-
setDouble
@NonNull @CheckReturnValue default SelfT setDouble(@NonNull String name, double v)
Sets the value for all occurrences ofnameto the provided Java primitive double.By default, this works with CQL type
double.To set the value to CQL
NULL, useSettableByIndex.setToNull(int), orset(i, v, Double.class).This method deals with case sensitivity in the way explained in the documentation of
AccessibleByName.- Throws:
IllegalArgumentException- if the name is invalid.
-
setFloat
@NonNull @CheckReturnValue default SelfT setFloat(@NonNull String name, float v)
Sets the value for all occurrences ofnameto the provided Java primitive float.By default, this works with CQL type
float.To set the value to CQL
NULL, useSettableByIndex.setToNull(int), orset(i, v, Float.class).This method deals with case sensitivity in the way explained in the documentation of
AccessibleByName.- Throws:
IllegalArgumentException- if the name is invalid.
-
setInt
@NonNull @CheckReturnValue default SelfT setInt(@NonNull String name, int v)
Sets the value for all occurrences ofnameto the provided Java primitive integer.By default, this works with CQL type
int.To set the value to CQL
NULL, useSettableByIndex.setToNull(int), orset(i, v, Integer.class).This method deals with case sensitivity in the way explained in the documentation of
AccessibleByName.- Throws:
IllegalArgumentException- if the name is invalid.
-
setLong
@NonNull @CheckReturnValue default SelfT setLong(@NonNull String name, long v)
Sets the value for all occurrences ofnameto the provided Java primitive long.By default, this works with CQL types
bigintandcounter.To set the value to CQL
NULL, useSettableByIndex.setToNull(int), orset(i, v, Long.class).This method deals with case sensitivity in the way explained in the documentation of
AccessibleByName.- Throws:
IllegalArgumentException- if the name is invalid.
-
setShort
@NonNull @CheckReturnValue default SelfT setShort(@NonNull String name, short v)
Sets the value for all occurrences ofnameto the provided Java primitive short.By default, this works with CQL type
smallint.To set the value to CQL
NULL, useSettableByIndex.setToNull(int), orset(i, v, Short.class).This method deals with case sensitivity in the way explained in the documentation of
AccessibleByName.- Throws:
IllegalArgumentException- if the name is invalid.
-
setInstant
@NonNull @CheckReturnValue default SelfT setInstant(@NonNull String name, @Nullable Instant v)
Sets the value for all occurrences ofnameto the provided Java instant.By default, this works with CQL type
timestamp.This method deals with case sensitivity in the way explained in the documentation of
AccessibleByName.- Throws:
IllegalArgumentException- if the name is invalid.
-
setLocalDate
@NonNull @CheckReturnValue default SelfT setLocalDate(@NonNull String name, @Nullable LocalDate v)
Sets the value for all occurrences ofnameto the provided Java local date.By default, this works with CQL type
date.This method deals with case sensitivity in the way explained in the documentation of
AccessibleByName.- Throws:
IllegalArgumentException- if the name is invalid.
-
setLocalTime
@NonNull @CheckReturnValue default SelfT setLocalTime(@NonNull String name, @Nullable LocalTime v)
Sets the value for all occurrences ofnameto the provided Java local time.By default, this works with CQL type
time.This method deals with case sensitivity in the way explained in the documentation of
AccessibleByName.- Throws:
IllegalArgumentException- if the name is invalid.
-
setByteBuffer
@NonNull @CheckReturnValue default SelfT setByteBuffer(@NonNull String name, @Nullable ByteBuffer v)
Sets the value for all occurrences ofnameto the provided Java byte buffer.By default, this works with CQL type
blob.This method deals with case sensitivity in the way explained in the documentation of
AccessibleByName.- Throws:
IllegalArgumentException- if the name is invalid.
-
setString
@NonNull @CheckReturnValue default SelfT setString(@NonNull String name, @Nullable String v)
Sets the value for all occurrences ofnameto the provided Java string.By default, this works with CQL types
text,varcharandascii.This method deals with case sensitivity in the way explained in the documentation of
AccessibleByName.- Throws:
IllegalArgumentException- if the name is invalid.
-
setBigInteger
@NonNull @CheckReturnValue default SelfT setBigInteger(@NonNull String name, @Nullable BigInteger v)
Sets the value for all occurrences ofnameto the provided Java big integer.By default, this works with CQL type
varint.This method deals with case sensitivity in the way explained in the documentation of
AccessibleByName.- Throws:
IllegalArgumentException- if the name is invalid.
-
setBigDecimal
@NonNull @CheckReturnValue default SelfT setBigDecimal(@NonNull String name, @Nullable BigDecimal v)
Sets the value for all occurrences ofnameto the provided Java big decimal.By default, this works with CQL type
decimal.This method deals with case sensitivity in the way explained in the documentation of
AccessibleByName.- Throws:
IllegalArgumentException- if the name is invalid.
-
setUuid
@NonNull @CheckReturnValue default SelfT setUuid(@NonNull String name, @Nullable UUID v)
Sets the value for all occurrences ofnameto the provided Java UUID.By default, this works with CQL types
uuidandtimeuuid.This method deals with case sensitivity in the way explained in the documentation of
AccessibleByName.- Throws:
IllegalArgumentException- if the name is invalid.
-
setInetAddress
@NonNull @CheckReturnValue default SelfT setInetAddress(@NonNull String name, @Nullable InetAddress v)
Sets the value for all occurrences ofnameto the provided Java IP address.By default, this works with CQL type
inet.This method deals with case sensitivity in the way explained in the documentation of
AccessibleByName.- Throws:
IllegalArgumentException- if the name is invalid.
-
setCqlDuration
@NonNull @CheckReturnValue default SelfT setCqlDuration(@NonNull String name, @Nullable CqlDuration v)
Sets the value for all occurrences ofnameto the provided duration.By default, this works with CQL type
duration.This method deals with case sensitivity in the way explained in the documentation of
AccessibleByName.- Throws:
IllegalArgumentException- if the name is invalid.
-
setVector
@NonNull @CheckReturnValue default <ElementT> SelfT setVector(@NonNull String name, @Nullable CqlVector<ElementT> v, @NonNull Class<ElementT> elementsClass)
Sets the value for all occurrences ofnameto the provided vector.By default, this works with CQL type
vector.This method deals with case sensitivity in the way explained in the documentation of
AccessibleByName.- Throws:
IllegalArgumentException- if the name is invalid.
-
setToken
@NonNull @CheckReturnValue default SelfT setToken(@NonNull String name, @NonNull Token v)
Sets the value for all occurrences ofnameto the provided token.This works with the CQL type matching the partitioner in use for this cluster:
bigintforMurmur3Partitioner,blobforByteOrderedPartitioner, andvarintforRandomPartitioner.This method deals with case sensitivity in the way explained in the documentation of
AccessibleByName.- Throws:
IllegalArgumentException- if the name is invalid.
-
setList
@NonNull @CheckReturnValue default <ElementT> SelfT setList(@NonNull String name, @Nullable List<ElementT> v, @NonNull Class<ElementT> elementsClass)
Sets the value for all occurrences ofnameto the provided Java list.By default, this works with CQL type
list.This method is provided for convenience when the element type is a non-generic type. For more complex list types, use
SettableByIndex.set(int, Object, GenericType).This method deals with case sensitivity in the way explained in the documentation of
AccessibleByName.- Throws:
IllegalArgumentException- if the name is invalid.
-
setSet
@NonNull @CheckReturnValue default <ElementT> SelfT setSet(@NonNull String name, @Nullable Set<ElementT> v, @NonNull Class<ElementT> elementsClass)
Sets the value for all occurrences ofnameto the provided Java set.By default, this works with CQL type
set.This method is provided for convenience when the element type is a non-generic type. For more complex set types, use
SettableByIndex.set(int, Object, GenericType).This method deals with case sensitivity in the way explained in the documentation of
AccessibleByName.- Throws:
IllegalArgumentException- if the name is invalid.
-
setMap
@NonNull @CheckReturnValue default <KeyT,ValueT> SelfT setMap(@NonNull String name, @Nullable Map<KeyT,ValueT> v, @NonNull Class<KeyT> keyClass, @NonNull Class<ValueT> valueClass)
Sets the value for all occurrences ofnameto the provided Java map.By default, this works with CQL type
map.This method is provided for convenience when the element type is a non-generic type. For more complex map types, use
SettableByIndex.set(int, Object, GenericType).This method deals with case sensitivity in the way explained in the documentation of
AccessibleByName.- Throws:
IllegalArgumentException- if the name is invalid.
-
setUdtValue
@NonNull @CheckReturnValue default SelfT setUdtValue(@NonNull String name, @Nullable UdtValue v)
Sets the value for all occurrences ofnameto the provided user defined type value.By default, this works with CQL user-defined types.
This method deals with case sensitivity in the way explained in the documentation of
AccessibleByName.- Throws:
IllegalArgumentException- if the name is invalid.
-
setTupleValue
@NonNull @CheckReturnValue default SelfT setTupleValue(@NonNull String name, @Nullable TupleValue v)
Sets the value for all occurrences ofnameto the provided tuple value.By default, this works with CQL tuples.
This method deals with case sensitivity in the way explained in the documentation of
AccessibleByName.- Throws:
IllegalArgumentException- if the name is invalid.
-
-