|
Openfire 3.5.2 Javadoc | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jivesoftware.util.Enum org.jivesoftware.util.IntEnum
public class IntEnum
A type safe enumeration object that is keyed by an Int value for switch statements and storage in DBs.
Used for indicating distinct states in a generic manner where each enum should have an associated int value. The given int should be unique for each enum value as hashCode and equals depends solely on the int value given. Most child classes should extend IntEnum and create static instances.
Field Summary | |
---|---|
protected static Hashtable |
enumTypes
|
Constructor Summary | |
---|---|
protected |
IntEnum(String name,
int val)
|
Method Summary | |
---|---|
boolean |
equals(Object object)
|
protected static IntEnum |
getEnumFromInt(Class enumClass,
int value)
Obtain the enum associated with the given value. |
int |
getValue()
Returns the int value associated with the enum. |
int |
hashCode()
|
protected static void |
register(IntEnum enumeration)
Checks in an enum for use in the getEnumFromInt() method. |
String |
toString()
|
Methods inherited from class org.jivesoftware.util.Enum |
---|
getName |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected static Hashtable enumTypes
Constructor Detail |
---|
protected IntEnum(String name, int val)
Method Detail |
---|
public int getValue()
public boolean equals(Object object)
equals
in class Enum
protected static void register(IntEnum enumeration)
Checks in an enum for use in the getEnumFromInt() method.
enumeration
- The enum to be registeredprotected static IntEnum getEnumFromInt(Class enumClass, int value)
Obtain the enum associated with the given value.
Values must be registered earlier using the register() method.
value
- the value to lookup the enum for
public int hashCode()
hashCode
in class Enum
public String toString()
toString
in class Enum
|
Openfire 3.5.2 Javadoc | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |