public class EnumUtils extends Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
EnumUtils.Coded
This interface must be implemented by enumerations to support
the creation of a code lookup map.
|
| Modifier and Type | Method and Description |
|---|---|
static <E extends Enum<E> & EnumUtils.Coded> |
createLookup(Class<E> enumClass)
Returns a new map providing code to enumeration lookup.
|
static <E extends Enum<E> & EnumUtils.Coded> |
getEnum(Class<E> enumClass,
int code,
E defEnum)
Returns an enumeration constant based on the code.
|
static <E extends Enum<E>> |
getEnum(Class<E> enumClass,
Object obj)
Returns the enumeration constant whose
toString() matches the toString() of the specified object. |
static <E extends Enum<E>> |
getEnumByName(Class<E> enumClass,
Object obj)
Returns the enumeration constant whose
name() matches
the toString() of the specified object. |
public static <E extends Enum<E>> E getEnum(Class<E> enumClass, Object obj)
toString() matches the toString() of the specified object.E - enumeration typeenumClass - enumeration classobj - objectpublic static <E extends Enum<E>> E getEnumByName(Class<E> enumClass, Object obj)
name() matches
the toString() of the specified object.E - enumeration typeenumClass - enumeration classobj - objectpublic static <E extends Enum<E> & EnumUtils.Coded> Map<Integer,E> createLookup(Class<E> enumClass)
E - enumeration typeenumClass - enumeration classpublic static <E extends Enum<E> & EnumUtils.Coded> E getEnum(Class<E> enumClass, int code, E defEnum)
E - enumeration typeenumClass - enumeration classcode - target codedefEnum - enumeration constant to return if code not foundCopyright © 2014. All Rights Reserved.