info.bioinfweb.jphyloio.objecttranslation.implementations

## Class EnumTranslator<E extends java.lang.Enum<E>>

- java.lang.Object
- - info.bioinfweb.jphyloio.objecttranslation.implementations.AbstractObjectTranslator<O>
  - - info.bioinfweb.jphyloio.objecttranslation.implementations.SimpleValueTranslator<O>
    - - info.bioinfweb.jphyloio.objecttranslation.implementations.IllegalArgumentExceptionSimpleValueTranslator<E>
      - - info.bioinfweb.jphyloio.objecttranslation.implementations.EnumTranslator<E>

- All Implemented Interfaces:
    ObjectTranslator<E>

      public class EnumTranslator<E extends java.lang.Enum<E>>
      extends IllegalArgumentExceptionSimpleValueTranslator<E>

- - ### Field Summary

    - ### Fields inherited from class info.bioinfweb.jphyloio.objecttranslation.implementations.SimpleValueTranslator

      `MAX_STRING_REPRESENTATION_LENGTH`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `EnumTranslator(java.lang.Class<E> enumClass)` Creates a new instance of this class.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.Class<E>` | `getObjectClass()` Returns the Java class of object instances created by this translator.
    `java.lang.String` | `javaToRepresentation(java.lang.Object object, WriterStreamDataProvider<?> streamDataProvider)` Converts the object by invoking its `Object.toString()` method.
    `protected E` | `parseValue(java.lang.String representation, ReaderStreamDataProvider<?> streamDataProvider)`

    - ### Methods inherited from class info.bioinfweb.jphyloio.objecttranslation.implementations.IllegalArgumentExceptionSimpleValueTranslator

      `representationToJava`

    - ### Methods inherited from class info.bioinfweb.jphyloio.objecttranslation.implementations.SimpleValueTranslator

      `hasStringRepresentation, readXMLRepresentation, writeXMLRepresentation`

    - ### Methods inherited from class info.bioinfweb.jphyloio.objecttranslation.implementations.AbstractObjectTranslator

      `equals, hashCode`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### EnumTranslator

          public EnumTranslator(java.lang.Class<E> enumClass)

      Creates a new instance of this class.
      Parameters:
        `enumClass` - the class of enum to be translated with the new instance
      Throws:
        `java.lang.NullPointerException` - if `enumClass` is `null`

  - ### Method Detail

    - #### getObjectClass

          public java.lang.Class<E> getObjectClass()

      Description copied from interface: `ObjectTranslator`
      Returns the Java class of object instances created by this translator.

      Note that `ObjectTranslator.javaToRepresentation(Object, WriterStreamDataProvider)` and `ObjectTranslator.writeXMLRepresentation(XMLStreamWriter, Object, WriterStreamDataProvider)` may also accept instances of other classes. This is independent from the return value here.

      Returns:
        the class of the handled objects

    - #### parseValue

          protected E parseValue(java.lang.String representation,
                                 ReaderStreamDataProvider<?> streamDataProvider)
                          throws java.lang.IllegalArgumentException

      Specified by:
        `parseValue` in class `IllegalArgumentExceptionSimpleValueTranslator<E extends java.lang.Enum<E>>`
      Throws:
        `java.lang.IllegalArgumentException`

    - #### javaToRepresentation

          public java.lang.String javaToRepresentation(java.lang.Object object,
                                                       WriterStreamDataProvider<?> streamDataProvider)
                                                throws java.lang.UnsupportedOperationException,
                                                       java.lang.ClassCastException

      Description copied from class: `SimpleValueTranslator`
      Converts the object by invoking its `Object.toString()` method.
      Specified by:
        `javaToRepresentation` in interface `ObjectTranslator<E extends java.lang.Enum<E>>`
      Overrides:
        `javaToRepresentation` in class `SimpleValueTranslator<E extends java.lang.Enum<E>>`
      Parameters:
        `object` - the object to be converted
        `streamDataProvider` - TODO
      Returns:
        the string representation of the object
      Throws:
        `java.lang.UnsupportedOperationException` - if objects handled by this instance can only be represented as XML
        `java.lang.ClassCastException` - if the specified object is not an instance of the supported class or does not implement the supported interface
      See Also:
        `ObjectTranslator.javaToRepresentation(java.lang.Object, WriterStreamDataProvider)`