E
- The Enum class this codec serializes from and deserializes to.public class EnumNameCodec<E extends Enum<E>> extends ParsingCodec<E>
Enum
instances as CQL varchar
s
representing their programmatic names as returned by Enum.name()
.
Note that this codec relies on the enum constant names;
it is therefore vital that enum names never change.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 |
---|
EnumNameCodec(Class<E> enumClass) |
EnumNameCodec(TypeCodec<String> innerCodec,
Class<E> enumClass) |
Modifier and Type | Method and Description |
---|---|
protected E |
fromString(String value)
Parse the given string into an object;
no special CQL unquoting should be applied here.
|
protected String |
toString(E value)
Return the String representation of the given object;
no special CQL quoting should be applied here.
|
deserialize, format, parse, serialize
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, varint
protected String toString(E value)
ParsingCodec
toString
in class ParsingCodec<E extends Enum<E>>
value
- the value to convert into a stringprotected E fromString(String value)
ParsingCodec
fromString
in class ParsingCodec<E extends Enum<E>>
value
- the string to parseCopyright © 2012–2018. All rights reserved.