T
- Type of the enum class.public class EnumTransform<T extends Enum<T>> extends Object implements org.simpleframework.xml.transform.Transform<T>
Transform
er similar to for enums which allows you to specify how unknown enum constants are handled.Constructor and Description |
---|
EnumTransform(Class<T> enumClass)
An enum transformer that uses the
strategyThrow() strategy. |
EnumTransform(Class<T> enumClass,
BiFunction<Class<T>,String,T> unknownEnumStrategy)
An enum transformer that uses the specified strategy for handling unknown enums.
|
Modifier and Type | Method and Description |
---|---|
T |
read(String value) |
static <T extends Enum<T>> |
strategyNull() |
static <T extends Enum<T>> |
strategyThrow() |
String |
write(T value) |
public EnumTransform(Class<T> enumClass)
strategyThrow()
strategy.enumClass
- Class of the enum type.public EnumTransform(Class<T> enumClass, BiFunction<Class<T>,String,T> unknownEnumStrategy)
enumClass
- Class of the enum type.unknownEnumStrategy
- Strategy for resolving unknown enums. It is passed the enum class and the serialized
string.public static <T extends Enum<T>> BiFunction<Class<T>,String,T> strategyNull()
null
.public static <T extends Enum<T>> BiFunction<Class<T>,String,T> strategyThrow()
IllegalArgumentException
.Copyright © 2020 XIMA MEDIA GmbH. All rights reserved.