public class EnumTypeManager
extends java.lang.Object
Please this is a singleton class, use getInstance()
to
get the EnumTypeManager instance.
Modifier and Type | Method and Description |
---|---|
EnumType |
getEnumType(java.lang.String enumTypeName,
java.lang.Object value)
Get an enumeration type by given type name and enumeration value.
|
java.lang.Object[] |
getEnumTypes(java.lang.String enumTypeName)
Retrieve a registered enumeration type.
|
static EnumTypeManager |
getInstance()
Use this method to get the single instance of enumeration manager.
|
void |
registerEnumTypes(java.lang.String enumTypeName,
EnumType[] enumTypes)
Register a new enumeration type into the manager.
|
public static EnumTypeManager getInstance()
public void registerEnumTypes(java.lang.String enumTypeName, EnumType[] enumTypes)
enumTypeName
- String the enumeration name.enumTypes
- EnumType[] the all posible values of this enumeration type.public java.lang.Object[] getEnumTypes(java.lang.String enumTypeName)
enumTypeName
- String enumeration type name.public EnumType getEnumType(java.lang.String enumTypeName, java.lang.Object value)
EnumType[] values=new EnumType[]{ new EnumType(1, "MALE"), new EnumType(2, "FEMALE") }; EnumTypeManager.getInstance().registerEnumTypes("SEX", values); //retrieve value 'new EnumType(1, "MALE")' EnumTypeManager.getInstance().getEnumType("SEX",new Integer(1));
enumTypeName
- String the enumeration type namevalue
- Object an enumeration value.Copyright © 2002 - 2010 Serva Software. All Rights Reserved.