com.genesyslab.platform.commons
Class GEnum
java.lang.Object
com.genesyslab.platform.commons.GEnum
- Direct Known Subclasses:
- CfgAccessGroupType, CfgActionCodeType, CfgAlarmCategory, CfgAppComponentType, CfgAppType, CfgCallActionCode, CfgCallMode, CfgChargeType, CfgDataType, CfgDialMode, CfgDIDGroupType, CfgDNGroupType, CfgDNRegisterFlag, CfgDNType, CfgEnumeratorObjectType, CfgEnumeratorType, CfgEnumType, CfgErrorType, CfgFieldType, CfgFlag, CfgFolderClass, CfgGroupType, CfgHAType, CfgHostType, CfgIVRProfileType, CfgIVRType, CfgLanguage, CfgLinkType, CfgMediaType, CfgObjectiveTableType, CfgObjectProperty, CfgObjectState, CfgObjectType, CfgOperationalMode, CfgOperationMode, CfgOptimizationMethod, CfgOSType, CfgPackCodeType, CfgPermissions, CfgPersonType, CfgRank, CfgRecActionCode, CfgResourceType, CfgRouteType, CfgScriptType, CfgSelectionMode, CfgSolutionType, CfgStartupType, CfgStatDayType, CfgStatTableType, CfgStructureType, CfgSwitchType, CfgTableType, CfgTargetType, CfgTaskType, CfgTraceMode, CfgTransactionType, CfgUpdatePackageStatus, ChannelState, ConfServerAccessGroupType, ConfServerActionCodeType, ConfServerAlarmCategory, ConfServerAppComponentType, ConfServerCallActionCode, ConfServerCallMode, ConfServerCallState, ConfServerChargeType, ConfServerClientType, ConfServerContactType, ConfServerDataType, ConfServerDialMode, ConfServerDIDGroupType, ConfServerDNGroupType, ConfServerDNRegisterFlag, ConfServerDNType, ConfServerEnumeratorObjectType, ConfServerEnumeratorType, ConfServerEnumType, ConfServerErrorType, ConfServerFieldType, ConfServerFlag, ConfServerFolderClass, ConfServerGroupType, ConfServerHAType, ConfServerHostType, ConfServerIVRProfileType, ConfServerIVRType, ConfServerLanguage, ConfServerLinkType, ConfServerMediaType, ConfServerObjectiveTableType, ConfServerObjectProperty, ConfServerObjectState, ConfServerObjectType, ConfServerOperationalMode, ConfServerOperationMode, ConfServerOptimizationMethod, ConfServerOSType, ConfServerPackCodeType, ConfServerPermissions, ConfServerPersonType, ConfServerRank, ConfServerRecActionCode, ConfServerRecordStatus, ConfServerRecordType, ConfServerResourceType, ConfServerRouteType, ConfServerScriptType, ConfServerSelectionMode, ConfServerSolutionType, ConfServerStartupType, ConfServerStatDayType, ConfServerStatTableType, ConfServerStructureType, ConfServerSwitchType, ConfServerTableType, ConfServerTargetType, ConfServerTaskType, ConfServerTraceMode, ConfServerTransactionType, ConfServerUpdatePackageStatus, ConnectionState, GctiCallState, GctiContactType, GctiRecordStatus, GctiRecordType
- public abstract class GEnum
- extends java.lang.Object
Superclass for classes that represent C-like (or JDK 1.5) enums.
"Type safe enum" pattern implementation with some extensions to retrieve
enum values by their "ordinal" integer values and names.
Method Summary |
java.lang.Integer |
asInteger()
Return Integer value of enum member. |
static int |
enumSize(java.lang.Class enumClass)
Return size (count of values) for the given enum
(specified by enumClass). |
boolean |
equals(java.lang.Object obj)
|
static GEnum |
getValue(java.lang.Class enumClass,
int ordinal)
Return enum value with specified ordinal value or null if no
such value exists. |
static GEnum |
getValue(java.lang.Class enumClass,
java.lang.Integer ordinal)
Return enum value with specified ordinal value or null if no
such value exists. |
static GEnum |
getValue(java.lang.Class enumClass,
java.lang.String name)
Return enum value with specified name or null if no
such value exists. |
int |
hashCode()
|
java.lang.String |
name()
Return name of the enum member. |
int |
ordinal()
Enum value as an integer. |
java.lang.String |
toString()
|
static java.util.Collection |
values(java.lang.Class enumClass)
Return all values of the given (specified by enumClass) enum. |
Methods inherited from class java.lang.Object |
getClass, notify, notifyAll, wait, wait, wait |
ordinal
public int ordinal()
- Enum value as an integer.
- Returns:
- int value of enum member
name
public java.lang.String name()
- Return name of the enum member.
- Returns:
- name of the enum member
toString
public java.lang.String toString()
equals
public boolean equals(java.lang.Object obj)
hashCode
public int hashCode()
values
public static java.util.Collection values(java.lang.Class enumClass)
- Return all values of the given (specified by enumClass) enum.
- Parameters:
enumClass
- Actual class of the enum
- Returns:
- All enum values
- Throws:
java.lang.IllegalArgumentException
- if enumClass is not enum
enumSize
public static int enumSize(java.lang.Class enumClass)
- Return size (count of values) for the given enum
(specified by enumClass).
- Parameters:
enumClass
- Actual class of the enum
- Returns:
- size of the enum
- Throws:
java.lang.IllegalArgumentException
- if enumClass is not enum
getValue
public static GEnum getValue(java.lang.Class enumClass,
java.lang.Integer ordinal)
- Return enum value with specified ordinal value or null if no
such value exists. Note that there is no guaranty for some arbitrary
enum that order is strict.
- Parameters:
enumClass
- Actual class of the enumordinal
- order of value in the enum
- Returns:
- enum value with specified ordinal or null
- Throws:
java.lang.IllegalArgumentException
- if enumClass is not enum
getValue
public static GEnum getValue(java.lang.Class enumClass,
int ordinal)
- Return enum value with specified ordinal value or null if no
such value exists. Note that there is no guaranty for some arbitrary
enum that order is strict.
- Parameters:
enumClass
- Actual class of the enumordinal
- order of value in the enum
- Returns:
- enum value with specified ordinal or null
- Throws:
java.lang.IllegalArgumentException
- if enumClass is not enum
getValue
public static GEnum getValue(java.lang.Class enumClass,
java.lang.String name)
- Return enum value with specified name or null if no
such value exists.
- Parameters:
enumClass
- Actual class of the enumname
- name of value in the enum
- Returns:
- enum value with specified ordinal or null
- Throws:
java.lang.IllegalArgumentException
- if enumClass is not enum
asInteger
public java.lang.Integer asInteger()
- Return Integer value of enum member. Use it when you really need
Integer. If you need int value use
ordinal()
method.
- Returns:
- Integer value of enum member
- See Also:
ordinal()
Send comments on this topic.
Copyright © 2006–2008 Genesys Telecommunication Laboratories, Inc. All rights reserved.