public abstract class EnumIO<E extends Enum<E>> extends Object implements PolymorphicSchema.Factory
| Modifier and Type | Class and Description |
|---|---|
static class |
EnumIO.ByName<E extends Enum<E>>
Reads the enum by its name.
|
static class |
EnumIO.ByNumber<E extends Enum<E>>
Reads the enum by its number.
|
| Modifier and Type | Method and Description |
|---|---|
String |
getAlias(Enum<?> element) |
E |
getByAlias(String alias) |
E |
getByTag(int tag) |
MapSchema.MessageFactory |
getEnumMapFactory()
Returns the factory for an EnumMap (lazy).
|
CollectionSchema.MessageFactory |
getEnumSetFactory()
Returns the factory for an EnumSet (lazy).
|
int |
getTag(Enum<?> element) |
<V> EnumMap<E,V> |
newEnumMap()
Returns an empty
EnumMap. |
EnumSet<E> |
newEnumSet()
Returns an empty
EnumSet. |
PolymorphicSchema |
newSchema(Class<?> typeClass,
IdStrategy strategy,
PolymorphicSchema.Handler handler) |
abstract E |
readFrom(Input input)
Read the enum from the input.
|
static void |
transfer(Pipe pipe,
Input input,
Output output,
int number,
boolean repeated)
Transfers the
Enum from the input to the output. |
void |
writeTo(Output output,
int number,
boolean repeated,
Enum<?> e)
Writes the
Enum to the output. |
public void writeTo(Output output, int number, boolean repeated, Enum<?> e) throws IOException
Enum to the output.IOExceptionpublic static void transfer(Pipe pipe, Input input, Output output, int number, boolean repeated) throws IOException
Enum from the input to the output.IOExceptionpublic PolymorphicSchema newSchema(Class<?> typeClass, IdStrategy strategy, PolymorphicSchema.Handler handler)
newSchema in interface PolymorphicSchema.Factorypublic int getTag(Enum<?> element)
public E getByTag(int tag)
public CollectionSchema.MessageFactory getEnumSetFactory()
public MapSchema.MessageFactory getEnumMapFactory()
public abstract E readFrom(Input input) throws IOException
IOExceptionCopyright © 2009–2016. All rights reserved.