E
- The Enum class this codec serializes from and deserializes to.public static class TypeCodec.EnumStringCodec<E extends Enum<E>> extends TypeCodec.StringParsingCodec<E>
Enum
instances as CQL varchar
s
representing their programmatic names as returned by Enum.name()
.
This codec is automatically used by the driver to create codecs for Enum
instances on the fly.
TypeCodec.AbstractUUIDCodec, TypeCodec.AsciiCodec, TypeCodec.BigintCodec, TypeCodec.BlobCodec, TypeCodec.BooleanCodec, TypeCodec.CollectionCodec<E,C extends Collection<E>>, TypeCodec.CounterCodec, TypeCodec.CustomCodec, TypeCodec.DateCodec, TypeCodec.DecimalCodec, TypeCodec.DoubleCodec, TypeCodec.EnumIntCodec<E extends Enum<E>>, TypeCodec.EnumStringCodec<E extends Enum<E>>, TypeCodec.FloatCodec, TypeCodec.InetCodec, TypeCodec.IntCodec, TypeCodec.ListCodec<T>, TypeCodec.LongCodec, TypeCodec.MapCodec<K,V>, TypeCodec.MappingCodec<T,U>, TypeCodec.PrimitiveBooleanCodec, TypeCodec.PrimitiveByteCodec, TypeCodec.PrimitiveDoubleCodec, TypeCodec.PrimitiveFloatCodec, TypeCodec.PrimitiveIntCodec, TypeCodec.PrimitiveLongCodec, TypeCodec.PrimitiveShortCodec, TypeCodec.SetCodec<T>, TypeCodec.SmallIntCodec, TypeCodec.StringCodec, TypeCodec.StringParsingCodec<T>, TypeCodec.TimeCodec, TypeCodec.TimestampCodec, TypeCodec.TimeUUIDCodec, TypeCodec.TinyIntCodec, TypeCodec.TupleCodec, TypeCodec.UDTCodec, TypeCodec.UUIDCodec, TypeCodec.VarcharCodec, TypeCodec.VarintCodec
Constructor and Description |
---|
EnumStringCodec(Class<E> enumClass) |
EnumStringCodec(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, equals, getCqlType, getJavaType, hashCode, toString
protected String toString(E value)
TypeCodec.StringParsingCodec
toString
in class TypeCodec.StringParsingCodec<E extends Enum<E>>
value
- the value to convert into a stringprotected E fromString(String value)
TypeCodec.StringParsingCodec
fromString
in class TypeCodec.StringParsingCodec<E extends Enum<E>>
value
- the string to parseCopyright © 2012–2015. All rights reserved.