net.sf.seaf.util.convert.simple
Class ConverterToEnum
java.lang.Object
net.sf.seaf.util.convert.simple.ConverterToEnum
public class ConverterToEnum
- extends Object
Converter of any Object to Enum.
|
Method Summary |
static
|
convert(Object o,
Class<E> enumClass)
Converts an Object to enum value. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ConverterToEnum
public ConverterToEnum()
convert
public static <E extends Enum<E>> E convert(Object o,
Class<E> enumClass)
throws IllegalArgumentException
- Converts an Object to enum value.
Keeps null as null. Keeps enum value as passed in. Otherwise converts via
String to an enum value of the given enum class.
- Parameters:
o - Object to be convertedenumClass - Target enum class
- Returns:
- Enum value
- Throws:
IllegalArgumentException - Thrown when the object cannot be converted to an instance of
the enumeration provided
Copyright © 2008-2011 SEAF. All Rights Reserved.