org.apache.commons.lang.enum
Class EnumUtils
Utility class for accessing and manipulating
Enum
s.
$Id: EnumUtils.java 161243 2005-04-14 04:30:28Z ggregory $- Stephen Colebourne
- Gary Gregory
static Enum | getEnum(Class enumClass, String name) - Gets an
Enum object by class and name.
|
static ValuedEnum | getEnum(Class enumClass, int value) - Gets a
ValuedEnum object by class and value.
|
static List | getEnumList(Class enumClass) - Gets the
List of Enum objects using
the Enum class.
|
static Map | getEnumMap(Class enumClass) - Gets the
Map of Enum objects by
name using the Enum class.
|
static Iterator | iterator(Class enumClass) - Gets an
Iterator over the Enum objects
in an Enum class.
|
EnumUtils
public EnumUtils()
Public constructor. This class should not normally be instantiated.
getEnum
public static Enum getEnum(Class enumClass,
String name)
Gets an Enum
object by class and name.
enumClass
- the class of the Enum
to getname
- the name of the Enum to get, may be null
getEnum
public static ValuedEnum getEnum(Class enumClass,
int value)
Gets a ValuedEnum
object by class and value.
enumClass
- the class of the Enum
to getvalue
- the value of the Enum
to get
- the enum object, or null if the enum does not exist
getEnumList
public static List getEnumList(Class enumClass)
Gets the
List
of
Enum
objects using
the
Enum
class.
The list is in the order that the objects were created
(source code order).
If the requested class has no enum objects an empty
List
is returned. The
List
is unmodifiable.
enumClass
- the class of the Enum to get
getEnumMap
public static Map getEnumMap(Class enumClass)
Gets the
Map
of
Enum
objects by
name using the
Enum
class.
If the requested class has no enum objects an empty
Map
is returned. The
Map
is unmodifiable.
enumClass
- the class of the Enum
to get
iterator
public static Iterator iterator(Class enumClass)
Gets an
Iterator
over the
Enum
objects
in an
Enum
class.
The iterator is in the order that the objects were created
(source code order).
If the requested class has no enum objects an empty
Iterator
is returned. The
Iterator
is unmodifiable.
enumClass
- the class of the Enum
to get
- an
Iterator
of the Enum
objects
Copyright © 2001-2005 - Apache Software Foundation