public abstract class EnumIO<E extends java.lang.Enum<E>> extends java.lang.Object implements PolymorphicSchema.Factory
| Modifier and Type | Class and Description |
|---|---|
static class |
EnumIO.ByName<E extends java.lang.Enum<E>>
Reads the enum by its name.
|
static class |
EnumIO.ByNumber<E extends java.lang.Enum<E>>
Reads the enum by its number.
|
| Modifier and Type | Field and Description |
|---|---|
java.lang.Class<E> |
enumClass
The enum class.
|
| Constructor and Description |
|---|
EnumIO(java.lang.Class<E> enumClass,
IdStrategy strategy) |
| Modifier and Type | Method and Description |
|---|---|
MapSchema.MessageFactory |
getEnumMapFactory()
Returns the factory for an EnumMap (lazy).
|
CollectionSchema.MessageFactory |
getEnumSetFactory()
Returns the factory for an EnumSet (lazy).
|
<V> java.util.EnumMap<E,V> |
newEnumMap()
Returns an empty
EnumMap. |
java.util.EnumSet<E> |
newEnumSet()
Returns an empty
EnumSet. |
PolymorphicSchema |
newSchema(java.lang.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. |
static void |
writeTo(Output output,
int number,
boolean repeated,
java.lang.Enum<?> e)
Writes the
Enum to the output. |
public EnumIO(java.lang.Class<E> enumClass, IdStrategy strategy)
public static void writeTo(Output output, int number, boolean repeated, java.lang.Enum<?> e) throws java.io.IOException
Enum to the output.java.io.IOExceptionpublic static void transfer(Pipe pipe, Input input, Output output, int number, boolean repeated) throws java.io.IOException
Enum from the input to the output.java.io.IOExceptionpublic PolymorphicSchema newSchema(java.lang.Class<?> typeClass, IdStrategy strategy, PolymorphicSchema.Handler handler)
newSchema in interface PolymorphicSchema.Factorypublic CollectionSchema.MessageFactory getEnumSetFactory()
public MapSchema.MessageFactory getEnumMapFactory()
public java.util.EnumSet<E> newEnumSet()
EnumSet.public <V> java.util.EnumMap<E,V> newEnumMap()
EnumMap.Copyright © 2009-2017. All Rights Reserved.