Class EnumTransform
- java.lang.Object
-
- org.simpleframework.xml.transform.EnumTransform
-
- All Implemented Interfaces:
Transform<java.lang.Enum>
class EnumTransform extends java.lang.Object implements Transform<java.lang.Enum>
TheEnumTransform
represents a transform that is used to transform enumerations to strings and back again. This is used when enumerations are used in comma separated arrays. This may be created multiple times for different types.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Class
type
This is the specific enumeration that this transforms.
-
Constructor Summary
Constructors Constructor Description EnumTransform(java.lang.Class type)
Constructor for theEnumTransform
object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Enum
read(java.lang.String value)
This method is used to convert the string value given to an appropriate representation.java.lang.String
write(java.lang.Enum value)
This method is used to convert the provided value into an XML usable format.
-
-
-
Constructor Detail
-
EnumTransform
public EnumTransform(java.lang.Class type)
Constructor for theEnumTransform
object. This is used to create enumerations from strings and convert them back again. This allows enumerations to be used in arrays.- Parameters:
type
- this is the enumeration type to be transformed
-
-
Method Detail
-
read
public java.lang.Enum read(java.lang.String value) throws java.lang.Exception
This method is used to convert the string value given to an appropriate representation. This is used when an object is being deserialized from the XML document and the value for the string representation is required.
-
write
public java.lang.String write(java.lang.Enum value) throws java.lang.Exception
This method is used to convert the provided value into an XML usable format. This is used in the serialization process when there is a need to convert a field value in to a string so that that value can be written as a valid XML entity.
-
-