E - The Enum class this codec serializes from and deserializes to.public class EnumOrdinalCodec<E extends Enum<E>> extends TypeCodec<E>
Enum instances as CQL ints representing their ordinal
values as returned by Enum.ordinal().
Note that this codec relies on the enum constants declaration order; it is therefore vital that this order remains immutable.
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 |
|---|
EnumOrdinalCodec(Class<E> enumClass) |
EnumOrdinalCodec(TypeCodec<Integer> innerCodec,
Class<E> enumClass) |
| Modifier and Type | Method and Description |
|---|---|
E |
deserialize(ByteBuffer bytes,
ProtocolVersion protocolVersion) |
String |
format(E value) |
E |
parse(String value) |
ByteBuffer |
serialize(E value,
ProtocolVersion protocolVersion) |
accepts, 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 ByteBuffer serialize(E value, ProtocolVersion protocolVersion) throws InvalidTypeException
public E deserialize(ByteBuffer bytes, ProtocolVersion protocolVersion) throws InvalidTypeException
deserialize in class TypeCodec<E extends Enum<E>>InvalidTypeExceptionpublic E parse(String value) throws InvalidTypeException
public String format(E value) throws InvalidTypeException
Copyright © 2012–2023. All rights reserved.