weka.core

## Class EnumHelper

- java.lang.Object
- - weka.core.EnumHelper

-     public class EnumHelper
      extends java.lang.Object

  Helper/wrapper class for obtaining an arbitrary enum value from an arbitrary enum type. An enum value wrapped in this class can be serialized by Weka's XML serialization mechanism.
  Version:
    $Revision: $
  Author:
    Mark Hall (mhall{[at]}pentaho{[dot]}com)

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `EnumHelper()` No-op constructor (for beans conformity)
    `EnumHelper(java.lang.Enum e)` Constructor

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String` | `getEnumClass()` Get the fully qualified enum class name
    `java.lang.String` | `getSelectedEnumValue()` Get the selected/wrapped enum value (as obtained by calling toString() on the enum value)
    `static void` | `main(java.lang.String[] args)` Main method for testing this class
    `void` | `setEnumClass(java.lang.String enumClass)` Set the fully qualified enum class name
    `void` | `setSelectedEnumValue(java.lang.String selectedEnumValue)` Set the selected/wrapped enum value (as obtained by calling toString() on the enum value)
    `static java.lang.Object` | `valueFromString(java.lang.String enmumClass, java.lang.String enumValue)` Helper method to recover an enum value given the fully qualified name of the enum and the value in question as strings

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

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### EnumHelper

          public EnumHelper(java.lang.Enum e)

      Constructor
      Parameters:
        `e` - the enum value to wrap

    - #### EnumHelper

          public EnumHelper()

      No-op constructor (for beans conformity)

  - ### Method Detail

    - #### setEnumClass

          public void setEnumClass(java.lang.String enumClass)

      Set the fully qualified enum class name
      Parameters:
        `enumClass` - the fully qualified name of the enum class

    - #### getEnumClass

          public java.lang.String getEnumClass()

      Get the fully qualified enum class name
      Returns:
        the fully qualified name of the enum class

    - #### setSelectedEnumValue

          public void setSelectedEnumValue(java.lang.String selectedEnumValue)

      Set the selected/wrapped enum value (as obtained by calling toString() on the enum value)
      Parameters:
        `selectedEnumValue` - the enum value to wrap

    - #### getSelectedEnumValue

          public java.lang.String getSelectedEnumValue()

      Get the selected/wrapped enum value (as obtained by calling toString() on the enum value)
      Returns:
        the enum value to wrap

    - #### valueFromString

          public static java.lang.Object valueFromString(java.lang.String enmumClass,
                                                         java.lang.String enumValue)
                                                  throws java.lang.Exception

      Helper method to recover an enum value given the fully qualified name of the enum and the value in question as strings
      Parameters:
        `enmumClass` - a string containing the fully qualified name of the enum class
        `enumValue` - a string containing the value of the enum to find
      Returns:
        the enum value as an Object
      Throws:
        `java.lang.Exception` - if a problem occurs

    - #### main

          public static void main(java.lang.String[] args)

      Main method for testing this class
      Parameters:
        `args` - arguments