public class EnumHelper
extends java.lang.Object
Constructor and Description |
---|
EnumHelper()
No-op constructor (for beans conformity)
|
EnumHelper(java.lang.Enum e)
Constructor
|
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.Class<?> enumClass,
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
|
static java.lang.Object |
valueFromString(java.lang.String enumClass,
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
|
public EnumHelper(java.lang.Enum e)
e
- the enum value to wrappublic EnumHelper()
public void setEnumClass(java.lang.String enumClass)
enumClass
- the fully qualified name of the enum classpublic java.lang.String getEnumClass()
public void setSelectedEnumValue(java.lang.String selectedEnumValue)
selectedEnumValue
- the enum value to wrappublic java.lang.String getSelectedEnumValue()
public static java.lang.Object valueFromString(java.lang.String enumClass, java.lang.String enumValue) throws java.lang.Exception
enumClass
- a string containing the fully qualified name of the enum
classenumValue
- a string containing the value of the enum to findjava.lang.Exception
- if a problem occurspublic static java.lang.Object valueFromString(java.lang.Class<?> enumClass, java.lang.String enumValue) throws java.lang.Exception
enumClass
- the class of the enumenumValue
- a string containing the value of the enum to findjava.lang.Exception
- if a problem occurspublic static void main(java.lang.String[] args)
args
- arguments