Interface GettableById

    • Method Detail

      • getBytesUnsafe

        @Nullable
        default ByteBuffer getBytesUnsafe​(@NonNull
                                          CqlIdentifier id)
        Returns the raw binary representation of the value for the first occurrence of id.

        This is primarily for internal use; you'll likely want to use one of the typed getters instead, to get a higher-level Java representation.

        If an identifier appears multiple times, this can only be used to access the first value. For the other ones, use positional getters.

        If you want to avoid the overhead of building a CqlIdentifier, use the variant of this method that takes a string argument.

        Returns:
        the raw value, or null if the CQL value is NULL. For performance reasons, this is the actual instance used internally. If you read data from the buffer, make sure to duplicate it beforehand, or only use relative methods. If you change the buffer's index or its contents in any way, any other getter invocation for this value will have unpredictable results.
        Throws:
        IllegalArgumentException - if the id is invalid.
      • isNull

        default boolean isNull​(@NonNull
                               CqlIdentifier id)
        Indicates whether the value for the first occurrence of id is a CQL NULL.

        If an identifier appears multiple times, this can only be used to access the first value. For the other ones, use positional getters.

        If you want to avoid the overhead of building a CqlIdentifier, use the variant of this method that takes a string argument.

        Throws:
        IllegalArgumentException - if the id is invalid.
      • get

        @Nullable
        default <ValueT> ValueT get​(@NonNull
                                    CqlIdentifier id,
                                    @NonNull
                                    TypeCodec<ValueT> codec)
        Returns the value for the first occurrence of id, 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.

        If an identifier appears multiple times, this can only be used to access the first value. For the other ones, use positional getters.

        If you want to avoid the overhead of building a CqlIdentifier, use the variant of this method that takes a string argument.

        Throws:
        IllegalArgumentException - if the id is invalid.
      • get

        @Nullable
        default <ValueT> ValueT get​(@NonNull
                                    CqlIdentifier id,
                                    @NonNull
                                    GenericType<ValueT> targetType)
        Returns the value for the first occurrence of id, 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 GettableByIndex.get(int, Class) instead, which may perform slightly better.

        If an identifier appears multiple times, this can only be used to access the first value. For the other ones, use positional getters.

        If you want to avoid the overhead of building a CqlIdentifier, use the variant of this method that takes a string argument.

        Throws:
        IllegalArgumentException - if the id is invalid.
        CodecNotFoundException - if no codec can perform the conversion.
      • get

        @Nullable
        default <ValueT> ValueT get​(@NonNull
                                    CqlIdentifier id,
                                    @NonNull
                                    Class<ValueT> targetClass)
        Returns the value for the first occurrence of id, 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 GettableByIndex.get(int, GenericType) instead.

        If an identifier appears multiple times, this can only be used to access the first value. For the other ones, use positional getters.

        If you want to avoid the overhead of building a CqlIdentifier, use the variant of this method that takes a string argument.

        Throws:
        IllegalArgumentException - if the id is invalid.
        CodecNotFoundException - if no codec can perform the conversion.
      • getBoolean

        default boolean getBoolean​(@NonNull
                                   CqlIdentifier id)
        Returns the value for the first occurrence of id as a Java primitive boolean.

        By default, this works with CQL type boolean.

        Note that, due to its signature, this method cannot return null. If the CQL value is NULL, it will return false. If this doesn't work for you, either call isNull(CqlIdentifier) before calling this method, or use get(id, Boolean.class) instead.

        If an identifier appears multiple times, this can only be used to access the first value. For the other ones, use positional getters.

        If you want to avoid the overhead of building a CqlIdentifier, use the variant of this method that takes a string argument.

        Throws:
        IllegalArgumentException - if the id is invalid.
      • getByte

        default byte getByte​(@NonNull
                             CqlIdentifier id)
        Returns the value for the first occurrence of id as a Java primitive byte.

        By default, this works with CQL type tinyint.

        Note that, due to its signature, this method cannot return null. If the CQL value is NULL, it will return 0. If this doesn't work for you, either call isNull(CqlIdentifier) before calling this method, or use get(id, Byte.class) instead.

        If an identifier appears multiple times, this can only be used to access the first value. For the other ones, use positional getters.

        If you want to avoid the overhead of building a CqlIdentifier, use the variant of this method that takes a string argument.

        Throws:
        IllegalArgumentException - if the id is invalid.
      • getDouble

        default double getDouble​(@NonNull
                                 CqlIdentifier id)
        Returns the value for the first occurrence of id as a Java primitive double.

        By default, this works with CQL type double.

        Note that, due to its signature, this method cannot return null. If the CQL value is NULL, it will return 0.0. If this doesn't work for you, either call isNull(CqlIdentifier) before calling this method, or use get(id, Double.class) instead.

        If an identifier appears multiple times, this can only be used to access the first value. For the other ones, use positional getters.

        If you want to avoid the overhead of building a CqlIdentifier, use the variant of this method that takes a string argument.

        Throws:
        IllegalArgumentException - if the id is invalid.
      • getFloat

        default float getFloat​(@NonNull
                               CqlIdentifier id)
        Returns the value for the first occurrence of id as a Java primitive float.

        By default, this works with CQL type float.

        Note that, due to its signature, this method cannot return null. If the CQL value is NULL, it will return 0.0. If this doesn't work for you, either call isNull(CqlIdentifier) before calling this method, or use get(id, Float.class) instead.

        If an identifier appears multiple times, this can only be used to access the first value. For the other ones, use positional getters.

        If you want to avoid the overhead of building a CqlIdentifier, use the variant of this method that takes a string argument.

        Throws:
        IllegalArgumentException - if the id is invalid.
      • getInt

        default int getInt​(@NonNull
                           CqlIdentifier id)
        Returns the value for the first occurrence of id as a Java primitive integer.

        By default, this works with CQL type int.

        Note that, due to its signature, this method cannot return null. If the CQL value is NULL, it will return 0. If this doesn't work for you, either call isNull(CqlIdentifier) before calling this method, or use get(id, Integer.class) instead.

        If an identifier appears multiple times, this can only be used to access the first value. For the other ones, use positional getters.

        If you want to avoid the overhead of building a CqlIdentifier, use the variant of this method that takes a string argument.

        Throws:
        IllegalArgumentException - if the id is invalid.
      • getLong

        default long getLong​(@NonNull
                             CqlIdentifier id)
        Returns the value for the first occurrence of id as a Java primitive long.

        By default, this works with CQL types bigint and counter.

        Note that, due to its signature, this method cannot return null. If the CQL value is NULL, it will return 0. If this doesn't work for you, either call isNull(CqlIdentifier) before calling this method, or use get(id, Long.class) instead.

        If an identifier appears multiple times, this can only be used to access the first value. For the other ones, use positional getters.

        If you want to avoid the overhead of building a CqlIdentifier, use the variant of this method that takes a string argument.

        Throws:
        IllegalArgumentException - if the id is invalid.
      • getShort

        default short getShort​(@NonNull
                               CqlIdentifier id)
        Returns the value for the first occurrence of id as a Java primitive short.

        By default, this works with CQL type smallint.

        Note that, due to its signature, this method cannot return null. If the CQL value is NULL, it will return 0. If this doesn't work for you, either call isNull(CqlIdentifier) before calling this method, or use get(id, Short.class) instead.

        If an identifier appears multiple times, this can only be used to access the first value. For the other ones, use positional getters.

        If you want to avoid the overhead of building a CqlIdentifier, use the variant of this method that takes a string argument.

        Throws:
        IllegalArgumentException - if the id is invalid.
      • getInstant

        @Nullable
        default Instant getInstant​(@NonNull
                                   CqlIdentifier id)
        Returns the value for the first occurrence of id as a Java instant.

        By default, this works with CQL type timestamp.

        If an identifier appears multiple times, this can only be used to access the first value. For the other ones, use positional getters.

        If you want to avoid the overhead of building a CqlIdentifier, use the variant of this method that takes a string argument.

        Throws:
        IllegalArgumentException - if the id is invalid.
      • getLocalDate

        @Nullable
        default LocalDate getLocalDate​(@NonNull
                                       CqlIdentifier id)
        Returns the value for the first occurrence of id as a Java local date.

        By default, this works with CQL type date.

        If an identifier appears multiple times, this can only be used to access the first value. For the other ones, use positional getters.

        If you want to avoid the overhead of building a CqlIdentifier, use the variant of this method that takes a string argument.

        Throws:
        IllegalArgumentException - if the id is invalid.
      • getLocalTime

        @Nullable
        default LocalTime getLocalTime​(@NonNull
                                       CqlIdentifier id)
        Returns the value for the first occurrence of id as a Java local time.

        By default, this works with CQL type time.

        If an identifier appears multiple times, this can only be used to access the first value. For the other ones, use positional getters.

        If you want to avoid the overhead of building a CqlIdentifier, use the variant of this method that takes a string argument.

        Throws:
        IllegalArgumentException - if the id is invalid.
      • getByteBuffer

        @Nullable
        default ByteBuffer getByteBuffer​(@NonNull
                                         CqlIdentifier id)
        Returns the value for the first occurrence of id as a Java byte buffer.

        By default, this works with CQL type blob.

        If an identifier appears multiple times, this can only be used to access the first value. For the other ones, use positional getters.

        If you want to avoid the overhead of building a CqlIdentifier, use the variant of this method that takes a string argument.

        Throws:
        IllegalArgumentException - if the id is invalid.
      • getString

        @Nullable
        default String getString​(@NonNull
                                 CqlIdentifier id)
        Returns the value for the first occurrence of id as a Java string.

        By default, this works with CQL types text, varchar and ascii.

        If an identifier appears multiple times, this can only be used to access the first value. For the other ones, use positional getters.

        If you want to avoid the overhead of building a CqlIdentifier, use the variant of this method that takes a string argument.

        Throws:
        IllegalArgumentException - if the id is invalid.
      • getBigInteger

        @Nullable
        default BigInteger getBigInteger​(@NonNull
                                         CqlIdentifier id)
        Returns the value for the first occurrence of id as a Java big integer.

        By default, this works with CQL type varint.

        If an identifier appears multiple times, this can only be used to access the first value. For the other ones, use positional getters.

        If you want to avoid the overhead of building a CqlIdentifier, use the variant of this method that takes a string argument.

        Throws:
        IllegalArgumentException - if the id is invalid.
      • getBigDecimal

        @Nullable
        default BigDecimal getBigDecimal​(@NonNull
                                         CqlIdentifier id)
        Returns the value for the first occurrence of id as a Java big decimal.

        By default, this works with CQL type decimal.

        If an identifier appears multiple times, this can only be used to access the first value. For the other ones, use positional getters.

        If you want to avoid the overhead of building a CqlIdentifier, use the variant of this method that takes a string argument.

        Throws:
        IllegalArgumentException - if the id is invalid.
      • getUuid

        @Nullable
        default UUID getUuid​(@NonNull
                             CqlIdentifier id)
        Returns the value for the first occurrence of id as a Java UUID.

        By default, this works with CQL types uuid and timeuuid.

        If an identifier appears multiple times, this can only be used to access the first value. For the other ones, use positional getters.

        If you want to avoid the overhead of building a CqlIdentifier, use the variant of this method that takes a string argument.

        Throws:
        IllegalArgumentException - if the id is invalid.
      • getInetAddress

        @Nullable
        default InetAddress getInetAddress​(@NonNull
                                           CqlIdentifier id)
        Returns the value for the first occurrence of id as a Java IP address.

        By default, this works with CQL type inet.

        If an identifier appears multiple times, this can only be used to access the first value. For the other ones, use positional getters.

        If you want to avoid the overhead of building a CqlIdentifier, use the variant of this method that takes a string argument.

        Throws:
        IllegalArgumentException - if the id is invalid.
      • getCqlDuration

        @Nullable
        default CqlDuration getCqlDuration​(@NonNull
                                           CqlIdentifier id)
        Returns the value for the first occurrence of id as a duration.

        By default, this works with CQL type duration.

        If an identifier appears multiple times, this can only be used to access the first value. For the other ones, use positional getters.

        If you want to avoid the overhead of building a CqlIdentifier, use the variant of this method that takes a string argument.

        Throws:
        IllegalArgumentException - if the id is invalid.
      • getVector

        @Nullable
        default <ElementT> CqlVector<ElementT> getVector​(@NonNull
                                                         CqlIdentifier id,
                                                         @NonNull
                                                         Class<ElementT> elementsClass)
        Returns the value for the first occurrence of id as a vector.

        By default, this works with CQL type vector.

        If an identifier appears multiple times, this can only be used to access the first value. For the other ones, use positional getters.

        If you want to avoid the overhead of building a CqlIdentifier, use the variant of this method that takes a string argument.

        Throws:
        IllegalArgumentException - if the id is invalid.
      • getToken

        @Nullable
        default Token getToken​(@NonNull
                               CqlIdentifier id)
        Returns the value for the first occurrence of id as a token.

        Note that, for simplicity, this method relies on the CQL type of the column to pick the correct token implementation. Therefore it must only be called on columns of the type that matches the partitioner in use for this cluster: bigint for Murmur3Partitioner, blob for ByteOrderedPartitioner, and varint for RandomPartitioner. Calling it for the wrong type will produce corrupt tokens that are unusable with this driver instance.

        If an identifier appears multiple times, this can only be used to access the first value. For the other ones, use positional getters.

        If you want to avoid the overhead of building a CqlIdentifier, use the variant of this method that takes a string argument.

        Throws:
        IllegalArgumentException - if the column type can not be converted to a known token type or if the name is invalid.
      • getList

        @Nullable
        default <ElementT> List<ElementT> getList​(@NonNull
                                                  CqlIdentifier id,
                                                  @NonNull
                                                  Class<ElementT> elementsClass)
        Returns the value for the first occurrence of id as a 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 GettableByIndex.get(int, GenericType).

        If an identifier appears multiple times, this can only be used to access the first value. For the other ones, use positional getters.

        If you want to avoid the overhead of building a CqlIdentifier, use the variant of this method that takes a string argument.

        Apache Cassandra does not make any distinction between an empty collection and null. Whether this method will return an empty collection or null will depend on the codec used; by default, the driver's built-in codecs all return empty collections.

        Throws:
        IllegalArgumentException - if the id is invalid.
      • getSet

        @Nullable
        default <ElementT> Set<ElementT> getSet​(@NonNull
                                                CqlIdentifier id,
                                                @NonNull
                                                Class<ElementT> elementsClass)
        Returns the value for the first occurrence of id as a 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 GettableByIndex.get(int, GenericType).

        If an identifier appears multiple times, this can only be used to access the first value. For the other ones, use positional getters.

        If you want to avoid the overhead of building a CqlIdentifier, use the variant of this method that takes a string argument.

        Apache Cassandra does not make any distinction between an empty collection and null. Whether this method will return an empty collection or null will depend on the codec used; by default, the driver's built-in codecs all return empty collections.

        Throws:
        IllegalArgumentException - if the id is invalid.
      • getMap

        @Nullable
        default <KeyT,​ValueT> Map<KeyT,​ValueT> getMap​(@NonNull
                                                                  CqlIdentifier id,
                                                                  @NonNull
                                                                  Class<KeyT> keyClass,
                                                                  @NonNull
                                                                  Class<ValueT> valueClass)
        Returns the value for the first occurrence of id as a 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 GettableByIndex.get(int, GenericType).

        If an identifier appears multiple times, this can only be used to access the first value. For the other ones, use positional getters.

        If you want to avoid the overhead of building a CqlIdentifier, use the variant of this method that takes a string argument.

        Apache Cassandra does not make any distinction between an empty collection and null. Whether this method will return an empty collection or null will depend on the codec used; by default, the driver's built-in codecs all return empty collections.

        Throws:
        IllegalArgumentException - if the id is invalid.
      • getUdtValue

        @Nullable
        default UdtValue getUdtValue​(@NonNull
                                     CqlIdentifier id)
        Returns the value for the first occurrence of id as a user defined type value.

        By default, this works with CQL user-defined types.

        If an identifier appears multiple times, this can only be used to access the first value. For the other ones, use positional getters.

        If you want to avoid the overhead of building a CqlIdentifier, use the variant of this method that takes a string argument.

        Throws:
        IllegalArgumentException - if the id is invalid.
      • getTupleValue

        @Nullable
        default TupleValue getTupleValue​(@NonNull
                                         CqlIdentifier id)
        Returns the value for the first occurrence of id as a tuple value.

        By default, this works with CQL tuples.

        If an identifier appears multiple times, this can only be used to access the first value. For the other ones, use positional getters.

        If you want to avoid the overhead of building a CqlIdentifier, use the variant of this method that takes a string argument.

        Throws:
        IllegalArgumentException - if the id is invalid.