E - The Java array component type this codec handlespublic class ObjectArrayCodec<E> extends AbstractArrayCodec<E[]>
For example, to create a codec that maps list<text> to String[], declare the
following:
ObjectArrayCodec<String> stringArrayCodec = new ObjectArrayCodec<>(
DataType.list(DataType.varchar()),
String[].class,
TypeCodec.varchar());
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| Constructor and Description |
|---|
ObjectArrayCodec(DataType.CollectionType cqlType,
Class<E[]> javaClass,
TypeCodec<E> eltCodec) |
| Modifier and Type | Method and Description |
|---|---|
E[] |
deserialize(ByteBuffer bytes,
ProtocolVersion protocolVersion) |
protected void |
formatElement(StringBuilder output,
E[] array,
int index)
Format the
indexth element of array to output. |
protected E[] |
newInstance(int size)
Create a new array instance with the given size.
|
protected void |
parseElement(String input,
E[] array,
int index)
Parse the
indexth element of array from input. |
ByteBuffer |
serialize(E[] value,
ProtocolVersion protocolVersion) |
format, parseaccepts, accepts, accepts, accepts, ascii, bigint, blob, cboolean, cdouble, cfloat, cint, counter, custom, date, decimal, duration, getCqlType, getJavaType, inet, list, map, set, smallInt, time, timestamp, timeUUID, tinyInt, toString, tuple, userType, uuid, varchar, varintpublic ObjectArrayCodec(DataType.CollectionType cqlType, Class<E[]> javaClass, TypeCodec<E> eltCodec)
public ByteBuffer serialize(E[] value, ProtocolVersion protocolVersion)
public E[] deserialize(ByteBuffer bytes, ProtocolVersion protocolVersion)
deserialize in class TypeCodec<E[]>protected void formatElement(StringBuilder output, E[] array, int index)
AbstractArrayCodecindexth element of array to output.formatElement in class AbstractArrayCodec<E[]>output - The StringBuilder to write to.array - The array to read from.index - The element index.protected void parseElement(String input, E[] array, int index)
AbstractArrayCodecindexth element of array from input.parseElement in class AbstractArrayCodec<E[]>input - The String to read from.array - The array to write to.index - The element index.protected E[] newInstance(int size)
AbstractArrayCodecnewInstance in class AbstractArrayCodec<E[]>size - The size of the array to instantiate.Copyright © 2012–2018. All rights reserved.