public class ListSerializer<T> extends CollectionSerializer<java.util.List<T>>
| Modifier and Type | Field and Description |
|---|---|
TypeSerializer<T> |
elements |
| Modifier and Type | Method and Description |
|---|---|
<V> java.util.List<T> |
deserializeForNativeProtocol(V input,
ValueAccessor<V> accessor,
ProtocolVersion version) |
java.nio.ByteBuffer |
getElement(java.nio.ByteBuffer input,
int index) |
<V> V |
getElement(V input,
ValueAccessor<V> accessor,
int index)
Returns the element at the given index in a list.
|
int |
getElementCount(java.util.List<T> value) |
static <T> ListSerializer<T> |
getInstance(TypeSerializer<T> elements) |
java.nio.ByteBuffer |
getSerializedValue(java.nio.ByteBuffer collection,
java.nio.ByteBuffer key,
AbstractType<?> comparator)
Extract an element from a serialized collection.
|
java.nio.ByteBuffer |
getSliceFromSerialized(java.nio.ByteBuffer collection,
java.nio.ByteBuffer from,
java.nio.ByteBuffer to,
AbstractType<?> comparator,
boolean frozen)
Returns the slice of a collection directly from its serialized value.
|
java.lang.Class<java.util.List<T>> |
getType() |
protected java.util.List<java.nio.ByteBuffer> |
serializeValues(java.util.List<T> values) |
java.lang.String |
toString(java.util.List<T> value) |
<V> void |
validateForNativeProtocol(V input,
ValueAccessor<V> accessor,
ProtocolVersion version) |
copyAsNewCollection, deserialize, deserializeForNativeProtocol, pack, pack, readCollectionSize, readCollectionSize, readValue, serialize, sizeOfCollectionSize, sizeOfValue, skipValue, skipValue, validate, writeCollectionSize, writeValuedeserialize, toCQLLiteral, validatepublic final TypeSerializer<T> elements
public static <T> ListSerializer<T> getInstance(TypeSerializer<T> elements)
protected java.util.List<java.nio.ByteBuffer> serializeValues(java.util.List<T> values)
serializeValues in class CollectionSerializer<java.util.List<T>>public int getElementCount(java.util.List<T> value)
getElementCount in class CollectionSerializer<java.util.List<T>>public <V> void validateForNativeProtocol(V input,
ValueAccessor<V> accessor,
ProtocolVersion version)
validateForNativeProtocol in class CollectionSerializer<java.util.List<T>>public <V> java.util.List<T> deserializeForNativeProtocol(V input, ValueAccessor<V> accessor, ProtocolVersion version)
deserializeForNativeProtocol in class CollectionSerializer<java.util.List<T>>public <V> V getElement(V input,
ValueAccessor<V> accessor,
int index)
input - a serialized listindex - the index to getpublic java.nio.ByteBuffer getElement(java.nio.ByteBuffer input,
int index)
public java.lang.String toString(java.util.List<T> value)
toString in class TypeSerializer<java.util.List<T>>public java.lang.Class<java.util.List<T>> getType()
getType in class TypeSerializer<java.util.List<T>>public java.nio.ByteBuffer getSerializedValue(java.nio.ByteBuffer collection,
java.nio.ByteBuffer key,
AbstractType<?> comparator)
CollectionSerializer
Note that this is only supported to sets and maps. For sets, this mostly ends up being
a check for the presence of the provide key: it will return the key if it's present and
null otherwise.
getSerializedValue in class CollectionSerializer<java.util.List<T>>collection - the serialized collection. This cannot be null.key - the key to extract (This cannot be null nor ByteBufferUtil.UNSET_BYTE_BUFFER).comparator - the type to use to compare the key value to those
in the collection.key if one exists, null otherwisepublic java.nio.ByteBuffer getSliceFromSerialized(java.nio.ByteBuffer collection,
java.nio.ByteBuffer from,
java.nio.ByteBuffer to,
AbstractType<?> comparator,
boolean frozen)
CollectionSerializerIf the slice contains no elements an empty collection will be returned for frozen collections, and a
null one for non-frozen collections.
getSliceFromSerialized in class CollectionSerializer<java.util.List<T>>collection - the serialized collection. This cannot be null.from - the left bound of the slice to extract. This cannot be null but if this is
ByteBufferUtil.UNSET_BYTE_BUFFER, then the returned slice starts at the beginning
of collection.comparator - the type to use to compare the from and to values to those
in the collection.frozen - true if the collection is a frozen one, false otherwise[from, to] of collection.Copyright © 2009-2022 The Apache Software Foundation