Class TypeCodec.PrimitiveFloatCodec
java.lang.Object
org.apache.cassandra.cql3.functions.types.TypeCodec<Float>
org.apache.cassandra.cql3.functions.types.TypeCodec.PrimitiveFloatCodec
A codec that is capable of handling primitive floats, thus avoiding the overhead of boxing and
unboxing such primitives.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.cassandra.cql3.functions.types.TypeCodec
TypeCodec.AbstractCollectionCodec<E,C extends Collection<E>>, TypeCodec.AbstractMapCodec<K, V>, TypeCodec.AbstractTupleCodec<T>, TypeCodec.AbstractUDTCodec<T>, TypeCodec.PrimitiveBooleanCodec, TypeCodec.PrimitiveByteCodec, TypeCodec.PrimitiveDoubleCodec, TypeCodec.PrimitiveFloatCodec, TypeCodec.PrimitiveIntCodec, TypeCodec.PrimitiveLongCodec, TypeCodec.PrimitiveShortCodec -
Method Summary
Modifier and TypeMethodDescriptiondeserialize(ByteBuffer bytes, ProtocolVersion protocolVersion) Deserialize the givenByteBufferinstance according to the CQL type handled by this codec.abstract floatdeserializeNoBoxing(ByteBuffer v, ProtocolVersion protocolVersion) serialize(Float value, ProtocolVersion protocolVersion) Serialize the given value according to the CQL type handled by this codec.abstract ByteBufferserializeNoBoxing(float v, ProtocolVersion protocolVersion) Methods inherited from class org.apache.cassandra.cql3.functions.types.TypeCodec
accepts, accepts, accepts, accepts, ascii, bigint, blob, cboolean, cdouble, cfloat, cint, counter, custom, date, decimal, duration, format, getCqlType, getJavaType, inet, isSerializedSizeFixed, list, map, parse, serializedSize, set, smallInt, time, timestamp, timeUUID, tinyInt, toString, tuple, userType, uuid, varchar, varint, vector
-
Method Details
-
serializeNoBoxing
-
deserializeNoBoxing
-
serialize
Description copied from class:TypeCodecSerialize the given value according to the CQL type handled by this codec.Implementation notes:
- Null values should be gracefully handled and no exception should be raised; these should be considered as the equivalent of a NULL CQL value;
- Codecs for CQL collection types should not permit null elements;
- Codecs for CQL collection types should treat a
nullinput as the equivalent of an empty collection.
- Specified by:
serializein classTypeCodec<Float>- Parameters:
value- An instance of T; may benull.protocolVersion- the protocol version to use when serializingbytes. In most cases, the proper value to provide for this argument is the value returned byProtocolOptions#getProtocolVersion(which is the protocol version in use by the driver).- Returns:
- A
ByteBufferinstance containing the serialized form of T
-
deserialize
Description copied from class:TypeCodecDeserialize the givenByteBufferinstance according to the CQL type handled by this codec.Implementation notes:
- Null or empty buffers should be gracefully handled and no exception should be raised;
these should be considered as the equivalent of a NULL CQL value and, in most cases,
should map to
nullor a default value for the corresponding Java type, if applicable; - Codecs for CQL collection types should clearly document whether they return immutable collections or not (note that the driver's default collection codecs return mutable collections);
- Codecs for CQL collection types should avoid returning
null; they should return empty collections instead (the driver's default collection codecs all comply with this rule). - The provided
ByteBuffershould never be consumed by read operations that modify its current position; if necessary,ByteBuffer.duplicate()duplicate} it before consuming.
- Specified by:
deserializein classTypeCodec<Float>- Parameters:
bytes- AByteBufferinstance containing the serialized form of T; may benullor empty.protocolVersion- the protocol version to use when serializingbytes. In most cases, the proper value to provide for this argument is the value returned byProtocolOptions#getProtocolVersion(which is the protocol version in use by the driver).- Returns:
- An instance of T
- Null or empty buffers should be gracefully handled and no exception should be raised;
these should be considered as the equivalent of a NULL CQL value and, in most cases,
should map to
-