Class EnumTransform

  • All Implemented Interfaces:
    Transform<java.lang.Enum>

    class EnumTransform
    extends java.lang.Object
    implements Transform<java.lang.Enum>
    The EnumTransform 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 the EnumTransform 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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • type

        private final java.lang.Class type
        This is the specific enumeration that this transforms.
    • Constructor Detail

      • EnumTransform

        public EnumTransform​(java.lang.Class type)
        Constructor for the EnumTransform 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.
        Specified by:
        read in interface Transform<java.lang.Enum>
        Parameters:
        value - this is the string representation of the value
        Returns:
        this returns an appropriate instanced to be used
        Throws:
        java.lang.Exception
      • 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.
        Specified by:
        write in interface Transform<java.lang.Enum>
        Parameters:
        value - this is the value to be converted to a string
        Returns:
        this is the string representation of the given value
        Throws:
        java.lang.Exception