E - The Enum class this codec serializes from and deserializes to.public class EnumOrdinalCodec<E extends Enum<E>>
extends com.datastax.driver.core.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.com.datastax.driver.core.TypeCodec.AbstractCollectionCodec<E,C extends Collection<E>>, com.datastax.driver.core.TypeCodec.AbstractMapCodec<K,V>, com.datastax.driver.core.TypeCodec.AbstractTupleCodec<T>, com.datastax.driver.core.TypeCodec.AbstractUDTCodec<T>, com.datastax.driver.core.TypeCodec.PrimitiveBooleanCodec, com.datastax.driver.core.TypeCodec.PrimitiveByteCodec, com.datastax.driver.core.TypeCodec.PrimitiveDoubleCodec, com.datastax.driver.core.TypeCodec.PrimitiveFloatCodec, com.datastax.driver.core.TypeCodec.PrimitiveIntCodec, com.datastax.driver.core.TypeCodec.PrimitiveLongCodec, com.datastax.driver.core.TypeCodec.PrimitiveShortCodec| Constructor and Description |
|---|
EnumOrdinalCodec(Class<E> enumClass) |
EnumOrdinalCodec(com.datastax.driver.core.TypeCodec<Integer> innerCodec,
Class<E> enumClass) |
| Modifier and Type | Method and Description |
|---|---|
E |
deserialize(ByteBuffer bytes,
com.datastax.driver.core.ProtocolVersion protocolVersion) |
String |
format(E value) |
E |
parse(String value) |
ByteBuffer |
serialize(E value,
com.datastax.driver.core.ProtocolVersion protocolVersion) |
accepts, accepts, accepts, accepts, ascii, bigint, blob, cboolean, cdouble, cfloat, cint, counter, custom, date, decimal, getCqlType, getJavaType, inet, list, map, set, smallInt, time, timestamp, timeUUID, tinyInt, toString, tuple, userType, uuid, varchar, varintpublic ByteBuffer serialize(E value, com.datastax.driver.core.ProtocolVersion protocolVersion) throws com.datastax.driver.core.exceptions.InvalidTypeException
public E deserialize(ByteBuffer bytes, com.datastax.driver.core.ProtocolVersion protocolVersion) throws com.datastax.driver.core.exceptions.InvalidTypeException
Copyright © 2012–2018. All rights reserved.