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.ByMapping<E extends java.lang.Enum<E>> |
static class |
EnumIO.ByName<E extends java.lang.Enum<E>>
Reads the enum by its name.
|
static class |
EnumIO.Eager |
static class |
EnumIO.Lazy |
static class |
EnumIO.Wrapper |
| 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 java.lang.Class<?> |
resolveEnumClass(java.lang.Class<?> clazz) |
abstract void |
transfer(Pipe pipe,
Input input,
Output output,
int number,
boolean repeated)
Transfers the
Enum from the input to the output. |
abstract void |
writeTo(Output output,
int number,
java.lang.Enum<?> e,
boolean repeated)
Writes the
Enum to the output. |
public EnumIO(java.lang.Class<E> enumClass, IdStrategy strategy)
public static java.lang.Class<?> resolveEnumClass(java.lang.Class<?> clazz)
public 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.public abstract E readFrom(Input input) throws java.io.IOException
java.io.IOExceptionpublic abstract void writeTo(Output output, int number, java.lang.Enum<?> e, boolean repeated) throws java.io.IOException
Enum to the output.java.io.IOExceptionCopyright © 2009-2023. All Rights Reserved.