org.apache.commons.lang.enum
クラス EnumUtils

java.lang.Object
  拡張org.apache.commons.lang.enum.EnumUtils

public class EnumUtils
extends Object

Utility class for accessing and manipulating Enums.

導入されたバージョン:
1.0
バージョン:
$Id: EnumUtils.java,v 1.1.1.1 2004/02/13 10:02:06 hioki Exp $
作成者:
Stephen Colebourne, Gary Gregory
関連項目:
Enum, ValuedEnum

コンストラクタの概要
EnumUtils()
          Public constructor.
 
メソッドの概要
static ValuedEnum getEnum(Class enumClass, int value)
          Gets a ValuedEnum object by class and value.
static Enum getEnum(Class enumClass, String name)
          Gets an Enum object by class and name.
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.
 
クラス java.lang.Object から継承したメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

コンストラクタの詳細

EnumUtils

public EnumUtils()
Public constructor. This class should not normally be instantiated.

導入されたバージョン:
2.0
メソッドの詳細

getEnum

public static Enum getEnum(Class enumClass,
                           String name)

Gets an Enum object by class and name.

パラメータ:
enumClass - the class of the Enum to get
name - the name of the Enum to get, may be null
戻り値:
the enum object
例外:
IllegalArgumentException - if the enum class is 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 get
value - the value of the Enum to get
戻り値:
the enum object, or null if the enum does not exist
例外:
IllegalArgumentException - if the enum class is null

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
戻り値:
the enum object Map
例外:
IllegalArgumentException - if the enum class is null
IllegalArgumentException - if the enum class is not a subclass of Enum

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
戻り値:
the enum object Map
例外:
IllegalArgumentException - if the enum class is null
IllegalArgumentException - if the enum class is not a subclass of Enum

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
例外:
IllegalArgumentException - if the enum class is null
IllegalArgumentException - if the enum class is not a subclass of Enum


このドキュメントは、Ja-Jakartaにより訳されました。 コメントがある場合は report@jajakarta.orgまでお願いします。
Translated into Japanese by jajakarta.org. The original page is here.
Copyright (c) 2002-2003 - Apache Software Foundation