Interface SettableByIndexData<T extends SettableByIndexData<T>>

  • All Known Subinterfaces:
    SettableData<T>
    All Known Implementing Classes:
    TupleValue, UDTValue

    public interface SettableByIndexData<T extends SettableByIndexData<T>>
    Collection of (typed) CQL values that can be set by index (starting at zero).
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      <V> T set​(int i, V v, com.google.common.reflect.TypeToken<V> targetType)
      Sets the ith value to the provided value of the provided Java type.
      <V> T set​(int i, V v, java.lang.Class<V> targetClass)
      Sets the ith value to the provided value of the provided Java class.
      <V> T set​(int i, V v, TypeCodec<V> codec)
      Sets the ith value to the provided value, converted using the given TypeCodec.
      T setBool​(int i, boolean v)
      Sets the ith value to the provided boolean.
      T setByte​(int i, byte v)
      Set the ith value to the provided byte.
      T setBytes​(int i, java.nio.ByteBuffer v)
      Sets the ith value to the provided byte buffer.
      T setBytesUnsafe​(int i, java.nio.ByteBuffer v)
      Sets the ith value to the provided byte buffer.
      T setDate​(int i, LocalDate v)
      Set the ith value to the provided date (without time).
      T setDecimal​(int i, java.math.BigDecimal v)
      Sets the ith value to the provided big decimal.
      T setDouble​(int i, double v)
      Sets the ith value to the provided double.
      T setFloat​(int i, float v)
      Sets the ith value to the provided float.
      T setInet​(int i, java.net.InetAddress v)
      Sets the ith value to the provided inet address.
      T setInt​(int i, int v)
      Set the ith value to the provided integer.
      <E> T setList​(int i, java.util.List<E> v)
      Sets the ith value to the provided list.
      <E> T setList​(int i, java.util.List<E> v, com.google.common.reflect.TypeToken<E> elementsType)
      Sets the ith value to the provided list, which elements are of the provided Java type.
      <E> T setList​(int i, java.util.List<E> v, java.lang.Class<E> elementsClass)
      Sets the ith value to the provided list, which elements are of the provided Java class.
      T setLong​(int i, long v)
      Sets the ith value to the provided long.
      <K,​V>
      T
      setMap​(int i, java.util.Map<K,​V> v)
      Sets the ith value to the provided map.
      <K,​V>
      T
      setMap​(int i, java.util.Map<K,​V> v, com.google.common.reflect.TypeToken<K> keysType, com.google.common.reflect.TypeToken<V> valuesType)
      Sets the ith value to the provided map, which keys and values are of the provided Java types.
      <K,​V>
      T
      setMap​(int i, java.util.Map<K,​V> v, java.lang.Class<K> keysClass, java.lang.Class<V> valuesClass)
      Sets the ith value to the provided map, which keys and values are of the provided Java classes.
      <E> T setSet​(int i, java.util.Set<E> v)
      Sets the ith value to the provided set.
      <E> T setSet​(int i, java.util.Set<E> v, com.google.common.reflect.TypeToken<E> elementsType)
      Sets the ith value to the provided set, which elements are of the provided Java type.
      <E> T setSet​(int i, java.util.Set<E> v, java.lang.Class<E> elementsClass)
      Sets the ith value to the provided set, which elements are of the provided Java class.
      T setShort​(int i, short v)
      Set the ith value to the provided short.
      T setString​(int i, java.lang.String v)
      Sets the ith value to the provided string.
      T setTime​(int i, long v)
      Set the ith value to the provided time as a long in nanoseconds since midnight.
      T setTimestamp​(int i, java.util.Date v)
      Set the ith value to the provided date.
      T setToNull​(int i)
      Sets the ith value to null.
      T setTupleValue​(int i, TupleValue v)
      Sets the ith value to the provided tuple value.
      T setUDTValue​(int i, UDTValue v)
      Sets the ith value to the provided UDT value.
      T setUUID​(int i, java.util.UUID v)
      Sets the ith value to the provided UUID.
      T setVarint​(int i, java.math.BigInteger v)
      Sets the ith value to the provided big integer.
    • Method Detail

      • setBool

        T setBool​(int i,
                  boolean v)
        Sets the ith value 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).

        Parameters:
        i - the index of the value to set.
        v - the value to set. To set the value to NULL, use setToNull(int) or set(i, v, Boolean.class)
        Returns:
        this object.
        Throws:
        java.lang.IndexOutOfBoundsException - if i is not a valid index for this object.
        CodecNotFoundException - if there is no registered codec to convert the value to the underlying CQL type.
      • setByte

        T setByte​(int i,
                  byte v)
        Set the ith value 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).

        Parameters:
        i - the index of the value to set.
        v - the value to set. To set the value to NULL, use setToNull(int) or set(i, v, Byte.class)
        Returns:
        this object.
        Throws:
        java.lang.IndexOutOfBoundsException - if i is not a valid index for this object.
        CodecNotFoundException - if there is no registered codec to convert the value to the underlying CQL type.
      • setShort

        T setShort​(int i,
                   short v)
        Set the ith value 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).

        Parameters:
        i - the index of the value to set.
        v - the value to set. To set the value to NULL, use setToNull(int) or set(i, v, Short.class)
        Returns:
        this object.
        Throws:
        java.lang.IndexOutOfBoundsException - if i is not a valid index for this object.
        CodecNotFoundException - if there is no registered codec to convert the value to the underlying CQL type.
      • setInt

        T setInt​(int i,
                 int v)
        Set the ith value 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).

        Parameters:
        i - the index of the value to set.
        v - the value to set. To set the value to NULL, use setToNull(int) or set(i, v, Integer.class)
        Returns:
        this object.
        Throws:
        java.lang.IndexOutOfBoundsException - if i is not a valid index for this object.
        CodecNotFoundException - if there is no registered codec to convert the value to the underlying CQL type.
      • setLong

        T setLong​(int i,
                  long v)
        Sets the ith value 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).

        Parameters:
        i - the index of the value to set.
        v - the value to set. To set the value to NULL, use setToNull(int) or set(i, v, Long.class)
        Returns:
        this object.
        Throws:
        java.lang.IndexOutOfBoundsException - if i is not a valid index for this object.
        CodecNotFoundException - if there is no registered codec to convert the value to the underlying CQL type.
      • setTimestamp

        T setTimestamp​(int i,
                       java.util.Date v)
        Set the ith value 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).

        Parameters:
        i - the index of the value to set.
        v - the value to set.
        Returns:
        this object.
        Throws:
        java.lang.IndexOutOfBoundsException - if i is not a valid index for this object.
        CodecNotFoundException - if there is no registered codec to convert the value to the underlying CQL type.
      • setDate

        T setDate​(int i,
                  LocalDate v)
        Set the ith value 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).

        Parameters:
        i - the index of the value to set.
        v - the value to set.
        Returns:
        this object.
        Throws:
        java.lang.IndexOutOfBoundsException - if i is not a valid index for this object.
        CodecNotFoundException - if there is no registered codec to convert the value to the underlying CQL type.
      • setTime

        T setTime​(int i,
                  long v)
        Set the ith value 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).

        Parameters:
        i - the index of the value to set.
        v - the value to set.
        Returns:
        this object.
        Throws:
        java.lang.IndexOutOfBoundsException - if i is not a valid index for this object.
        CodecNotFoundException - if there is no registered codec to convert the value to the underlying CQL type.
      • setFloat

        T setFloat​(int i,
                   float v)
        Sets the ith value 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).

        Parameters:
        i - the index of the value to set.
        v - the value to set. To set the value to NULL, use setToNull(int) or set(i, v, Float.class)
        Returns:
        this object.
        Throws:
        java.lang.IndexOutOfBoundsException - if i is not a valid index for this object.
        CodecNotFoundException - if there is no registered codec to convert the value to the underlying CQL type.
      • setDouble

        T setDouble​(int i,
                    double v)
        Sets the ith value 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).

        Parameters:
        i - the index of the value to set.
        v - the value to set. To set the value to NULL, use setToNull(int) or set(i, v, Double.class).
        Returns:
        this object.
        Throws:
        java.lang.IndexOutOfBoundsException - if i is not a valid index for this object.
        CodecNotFoundException - if there is no registered codec to convert the value to the underlying CQL type.
      • setString

        T setString​(int i,
                    java.lang.String v)
        Sets the ith value 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).

        Parameters:
        i - the index of the value to set.
        v - the value to set.
        Returns:
        this object.
        Throws:
        java.lang.IndexOutOfBoundsException - if i is not a valid index for this object.
        CodecNotFoundException - if there is no registered codec to convert the value to the underlying CQL type.
      • setBytes

        T setBytes​(int i,
                   java.nio.ByteBuffer v)
        Sets the ith value 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).

        Parameters:
        i - the index of the value to set.
        v - the value to set.
        Returns:
        this object.
        Throws:
        java.lang.IndexOutOfBoundsException - if i is not a valid index for this object.
        CodecNotFoundException - if there is no registered codec to convert the value to the underlying CQL type.
      • setBytesUnsafe

        T setBytesUnsafe​(int i,
                         java.nio.ByteBuffer v)
        Sets the ith value 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.

        Parameters:
        i - the index of the value to set.
        v - the value to set.
        Returns:
        this object.
        Throws:
        java.lang.IndexOutOfBoundsException - if i is not a valid index for this object.
      • setVarint

        T setVarint​(int i,
                    java.math.BigInteger v)
        Sets the ith value 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).

        Parameters:
        i - the index of the value to set.
        v - the value to set.
        Returns:
        this object.
        Throws:
        java.lang.IndexOutOfBoundsException - if i is not a valid index for this object.
        CodecNotFoundException - if there is no registered codec to convert the value to the underlying CQL type.
      • setDecimal

        T setDecimal​(int i,
                     java.math.BigDecimal v)
        Sets the ith value 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).

        Parameters:
        i - the index of the value to set.
        v - the value to set.
        Returns:
        this object.
        Throws:
        java.lang.IndexOutOfBoundsException - if i is not a valid index for this object.
        CodecNotFoundException - if there is no registered codec to convert the value to the underlying CQL type.
      • setUUID

        T setUUID​(int i,
                  java.util.UUID v)
        Sets the ith value 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).

        Parameters:
        i - the index of the value to set.
        v - the value to set.
        Returns:
        this object.
        Throws:
        java.lang.IndexOutOfBoundsException - if i is not a valid index for this object.
        CodecNotFoundException - if there is no registered codec to convert the value to the underlying CQL type.
      • setInet

        T setInet​(int i,
                  java.net.InetAddress v)
        Sets the ith value 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).

        Parameters:
        i - the index of the value to set.
        v - the value to set.
        Returns:
        this object.
        Throws:
        java.lang.IndexOutOfBoundsException - if i is not a valid index for this object.
        CodecNotFoundException - if there is no registered codec to convert the value to the underlying CQL type.
      • setList

        <E> T setList​(int i,
                      java.util.List<E> v)
        Sets the ith value 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(int, List, Class) or setList(int, List, TypeToken).

        Parameters:
        i - the index of the value to set.
        v - the value to set. Note that null values inside collections are not supported by CQL.
        Returns:
        this object.
        Throws:
        java.lang.IndexOutOfBoundsException - if i is not a valid index for this object.
        java.lang.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.
      • setList

        <E> T setList​(int i,
                      java.util.List<E> v,
                      java.lang.Class<E> elementsClass)
        Sets the ith value 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(int, List, TypeToken).

        Parameters:
        i - the index of the value to set.
        v - the value to set. Note that null values inside collections are not supported by CQL.
        elementsClass - the class for the elements of the list.
        Returns:
        this object.
        Throws:
        java.lang.IndexOutOfBoundsException - if i is not a valid index for this object.
        java.lang.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.
      • setList

        <E> T setList​(int i,
                      java.util.List<E> v,
                      com.google.common.reflect.TypeToken<E> elementsType)
        Sets the ith value 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.

        Parameters:
        i - the index of the value to set.
        v - the value to set. Note that null values inside collections are not supported by CQL.
        elementsType - the type for the elements of the list.
        Returns:
        this object.
        Throws:
        java.lang.IndexOutOfBoundsException - if i is not a valid index for this object.
        java.lang.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.
      • setMap

        <K,​V> T setMap​(int i,
                             java.util.Map<K,​V> v)
        Sets the ith value 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(int, Map, Class, Class) or setMap(int, Map, TypeToken, TypeToken).

        Parameters:
        i - the index of the value to set.
        v - the value to set. Note that null values inside collections are not supported by CQL.
        Returns:
        this object.
        Throws:
        java.lang.IndexOutOfBoundsException - if i is not a valid index for this object.
        java.lang.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.
      • setMap

        <K,​V> T setMap​(int i,
                             java.util.Map<K,​V> v,
                             java.lang.Class<K> keysClass,
                             java.lang.Class<V> valuesClass)
        Sets the ith value 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(int, Map, TypeToken, TypeToken).

        Parameters:
        i - the index of the value to 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.
        Returns:
        this object.
        Throws:
        java.lang.IndexOutOfBoundsException - if i is not a valid index for this object.
        java.lang.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.
      • setMap

        <K,​V> T setMap​(int i,
                             java.util.Map<K,​V> v,
                             com.google.common.reflect.TypeToken<K> keysType,
                             com.google.common.reflect.TypeToken<V> valuesType)
        Sets the ith value 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.

        Parameters:
        i - the index of the value to 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.
        Returns:
        this object.
        Throws:
        java.lang.IndexOutOfBoundsException - if i is not a valid index for this object.
        java.lang.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.
      • setSet

        <E> T setSet​(int i,
                     java.util.Set<E> v)
        Sets the ith value 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(int, Set, Class) or setSet(int, Set, TypeToken).

        Parameters:
        i - the index of the value to set.
        v - the value to set. Note that null values inside collections are not supported by CQL.
        Returns:
        this object.
        Throws:
        java.lang.IndexOutOfBoundsException - if i is not a valid index for this object.
        java.lang.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.
      • setSet

        <E> T setSet​(int i,
                     java.util.Set<E> v,
                     java.lang.Class<E> elementsClass)
        Sets the ith value 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(int, Set, TypeToken).

        Parameters:
        i - the index of the value to set.
        v - the value to set. Note that null values inside collections are not supported by CQL.
        elementsClass - the class for the elements of the set.
        Returns:
        this object.
        Throws:
        java.lang.IndexOutOfBoundsException - if i is not a valid index for this object.
        java.lang.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.
      • setSet

        <E> T setSet​(int i,
                     java.util.Set<E> v,
                     com.google.common.reflect.TypeToken<E> elementsType)
        Sets the ith value 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.

        Parameters:
        i - the index of the value to set.
        v - the value to set. Note that null values inside collections are not supported by CQL.
        elementsType - the type for the elements of the set.
        Returns:
        this object.
        Throws:
        java.lang.IndexOutOfBoundsException - if i is not a valid index for this object.
        java.lang.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.
      • setUDTValue

        T setUDTValue​(int i,
                      UDTValue v)
        Sets the ith value 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.

        Parameters:
        i - the index of the value to set.
        v - the value to set.
        Returns:
        this object.
        Throws:
        java.lang.IndexOutOfBoundsException - if i is not a valid index for this object.
        CodecNotFoundException - if there is no registered codec to convert the value to the underlying CQL type.
      • setTupleValue

        T setTupleValue​(int i,
                        TupleValue v)
        Sets the ith value 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.

        Parameters:
        i - the index of the value to set.
        v - the value to set.
        Returns:
        this object.
        Throws:
        java.lang.IndexOutOfBoundsException - if i is not a valid index for this object.
        CodecNotFoundException - if there is no registered codec to convert the value to the underlying CQL type.
      • setToNull

        T setToNull​(int i)
        Sets the ith value to null.

        This is mainly intended for CQL types which map to native Java types.

        Parameters:
        i - the index of the value to set.
        Returns:
        this object.
        Throws:
        java.lang.IndexOutOfBoundsException - if i is not a valid index for this object.
      • set

        <V> T set​(int i,
                  V v,
                  java.lang.Class<V> targetClass)
        Sets the ith value 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(int, Object, TypeToken) instead.

        Parameters:
        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;
        Returns:
        this object.
        Throws:
        java.lang.IndexOutOfBoundsException - if i is not a valid index for this object.
        CodecNotFoundException - if there is no registered codec to convert the value to the underlying CQL type.
      • set

        <V> T set​(int i,
                  V v,
                  com.google.common.reflect.TypeToken<V> targetType)
        Sets the ith value 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.

        Parameters:
        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;
        Returns:
        this object.
        Throws:
        java.lang.IndexOutOfBoundsException - if i is not a valid index for this object.
        CodecNotFoundException - if there is no registered codec to convert the value to the underlying CQL type.
      • set

        <V> T set​(int i,
                  V v,
                  TypeCodec<V> codec)
        Sets the ith value 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 InvalidTypeExceptions being thrown.

        Parameters:
        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.
        Returns:
        this object.
        Throws:
        InvalidTypeException - if the given codec does not accept the underlying CQL type.
        java.lang.IndexOutOfBoundsException - if i is not a valid index for this object.