|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.opengts.util.EnumTools
public class EnumTools
Contains tools for custom enumerated types.
| Nested Class Summary | |
|---|---|
static interface |
EnumTools.BitMask
BitMask interface |
static interface |
EnumTools.DoubleValue
DoubleValue interface |
static interface |
EnumTools.IntValue
IntValue interface |
static interface |
EnumTools.IsDefault
IsDefault interface |
static interface |
EnumTools.LongValue
LongValue interface |
static interface |
EnumTools.StringLocale
StringLocale interface |
static interface |
EnumTools.StringValue
StringValue interface |
static class |
EnumTools.TestEnum
|
| Constructor Summary | |
|---|---|
EnumTools()
|
|
| Method Summary | ||
|---|---|---|
static
|
getDefault(java.lang.Class<T> enumClass)
Returns the default enum constant of the specified enum type. |
|
static java.lang.Class<? extends java.lang.Enum> |
getEnumClass(java.lang.Class enumContainerClass,
java.lang.String name)
Returns the registered Enum class for the specified name |
|
static java.lang.Class<? extends java.lang.Enum> |
getEnumClass(java.lang.String name)
Returns the registered Enum class for the specified name |
|
static
|
getIntValueMap(java.lang.Class<T> enumClass)
Returns a String array of enumerated type 'toString()' values for the specified Enum type class |
|
static
|
getIntValueMap(java.lang.Class<T> enumClass,
java.util.Locale loc)
Returns a localized String array of enumerated type 'toString()' values for the specified Enum type class |
|
static
|
getValueMap(java.lang.Class<T> enumClass)
Returns a String array of enumerated type 'toString()' values for the specified Enum type class |
|
static
|
getValueMap(java.lang.Class<T> enumClass,
java.util.Locale loc)
Returns a localized String array of enumerated type 'toString()' values for the specified Enum type class |
|
static
|
getValueMap(java.lang.Class<T> enumClass,
T[] list,
java.util.Locale loc)
Returns a localized String array of enumerated type 'toString()' values for the specified Enum type class |
|
static
|
getValueMask(java.lang.Class<T> enumClass)
For 'BitMask' enumerated types, this method returns the logical 'OR' or all values. |
|
static
|
getValueNames(java.lang.Class<T> enumClass)
Returns a String array of enumerated type 'toString()' values for the specified Enum type class |
|
static
|
getValueNames(java.lang.Class<T> enumClass,
java.util.Locale loc)
Returns a localized String array of enumerated type 'toString()' values for the specified Enum type class |
|
static
|
getValueNames(java.lang.Class<T> enumClass,
T[] list,
java.util.Locale loc)
Returns a localized String array of enumerated type 'toString()' values for the specified Enum type class |
|
static
|
getValueOf(java.lang.Class<T> enumClass,
int value)
Returns the enum constant of the specified enum type with the specified integer value. |
|
static
|
getValueOf(java.lang.Class<T> enumClass,
int value,
T dft)
Returns the enum constant of the specified enum type with the specified integer value. |
|
static
|
getValueOf(java.lang.Class<T> enumClass,
int value,
T dft,
boolean rtnDefault)
Returns the enum constant of the specified enum type with the specified integer value. |
|
static
|
getValueOf(java.lang.Class<T> enumClass,
java.lang.String name)
Returns the enum constant of the specified enum type with the specified name or 'toString()' value. |
|
static
|
getValueOf(java.lang.Class<T> enumClass,
java.lang.String name,
java.util.Locale loc)
Returns the enum constant of the specified enum type with the specified name or 'toString()' value. |
|
protected static
|
getValueOf(java.lang.Class<T> enumClass,
java.lang.String name,
java.util.Locale loc,
T dft,
boolean rtnDefault)
Returns the enum constant of the specified enum type with the specified name or 'toString()' value. |
|
static
|
getValueOf(java.lang.Class<T> enumClass,
java.lang.String name,
T dft)
Returns the enum constant of the specified enum type with the specified name or 'toString()' value. |
|
static
|
getValueOf(java.lang.Class<T> enumClass,
T value)
Returns the enum constant of the specified enum type with the specified integer value. |
|
static
|
getValueOf(java.lang.Class<T> enumClass,
T value,
T dft)
Returns the specified enum constant or a default if the enum constant is null. |
|
static
|
getValueOf(java.lang.Class<T> enumClass,
T value,
T dft,
boolean rtnDefault)
Returns the specified enum constant or a default if the enum constant is null. |
|
static
|
getValuesForMask(java.lang.Class<T> enumClass,
long mask)
Returns a list of Enumerated BitMask values for the specified mask |
|
static void |
main(java.lang.String[] argv)
Main entry point for testing/debugging |
|
static
|
registerEnumClass(java.lang.Class<T> enumClass)
Registers the specified Enum classes |
|
static
|
registerEnumClass(java.lang.String name,
java.lang.Class<T> enumClass)
Registers the specified Enum classes |
|
static void |
registerPublicEnumClasses(java.lang.Class<?> enumContainerClass)
Registers all public Enum classes defined within the specified class. This is used to allow referencing an enumerated type by name (ie. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public EnumTools()
| Method Detail |
|---|
public static <T extends java.lang.Enum<T>> java.util.Map<java.lang.String,java.lang.String> getValueMap(java.lang.Class<T> enumClass,
T[] list,
java.util.Locale loc)
enumClass - The enumerated type classlist - The array of enumerated types from which the localized Strings will be extractedloc - The Locale
public static <T extends java.lang.Enum<T>> java.util.Map<java.lang.String,java.lang.String> getValueMap(java.lang.Class<T> enumClass,
java.util.Locale loc)
enumClass - The enumerated type classloc - The Locale
public static <T extends java.lang.Enum<T>> java.util.Map<java.lang.String,java.lang.String> getValueMap(java.lang.Class<T> enumClass)
enumClass - The enumerated type class
public static <T extends java.lang.Enum<T>> java.util.Map<java.lang.Integer,java.lang.String> getIntValueMap(java.lang.Class<T> enumClass,
java.util.Locale loc)
enumClass - The enumerated type classloc - The Locale
public static <T extends java.lang.Enum<T>> java.util.Map<java.lang.Integer,java.lang.String> getIntValueMap(java.lang.Class<T> enumClass)
enumClass - The enumerated type class
public static <T extends java.lang.Enum<T>> java.lang.String[] getValueNames(java.lang.Class<T> enumClass,
T[] list,
java.util.Locale loc)
enumClass - The enumerated type classlist - The array of enumerated types from which the localized Strings will be extractedloc - The Locale
public static <T extends java.lang.Enum<T>> java.lang.String[] getValueNames(java.lang.Class<T> enumClass,
java.util.Locale loc)
enumClass - The enumerated type classloc - The Locale
public static <T extends java.lang.Enum<T>> java.lang.String[] getValueNames(java.lang.Class<T> enumClass)
enumClass - The enumerated type class
public static <T extends java.lang.Enum<T>> T getDefault(java.lang.Class<T> enumClass)
enumClass - The Class object of the enum type from which to return a constant
public static <T extends java.lang.Enum<T>> T getValueOf(java.lang.Class<T> enumClass,
java.lang.String name)
enumClass - The Class object of the enum type from which to return a constantname - The name of the constant to return
public static <T extends java.lang.Enum<T>> T getValueOf(java.lang.Class<T> enumClass,
java.lang.String name,
T dft)
enumClass - The Class object of the enum type from which to return a constantname - The name of the constant to returndft - The default type to return if the name was not found
public static <T extends java.lang.Enum<T>> T getValueOf(java.lang.Class<T> enumClass,
java.lang.String name,
java.util.Locale loc)
enumClass - The Class object of the enum type from which to return a constantname - The name of the constant to returnloc - The Locale
protected static <T extends java.lang.Enum<T>> T getValueOf(java.lang.Class<T> enumClass,
java.lang.String name,
java.util.Locale loc,
T dft,
boolean rtnDefault)
enumClass - The Class object of the enum type from which to return a constantname - The name of the constant to returnloc - The Localedft - The default type to return if the name was not found, and 'rtnDefault' is false.rtnDefault - True to return the first constant if name was not found and 'dft' is null.
public static <T extends java.lang.Enum<T>> T getValueOf(java.lang.Class<T> enumClass,
int value)
enumClass - The Class object of the enum type from which to return a constantvalue - The integer value of the constant to return
public static <T extends java.lang.Enum<T>> T getValueOf(java.lang.Class<T> enumClass,
int value,
T dft)
enumClass - The Class object of the enum type from which to return a constantvalue - The integer value of the constant to returndft - The default type to return if the integer value was not found, and 'rtnDefault' is false.
public static <T extends java.lang.Enum<T>> T getValueOf(java.lang.Class<T> enumClass,
int value,
T dft,
boolean rtnDefault)
enumClass - The Class object of the enum type from which to return a constantvalue - The integer value of the constant to returndft - The default type to return if the integer value was not found, and 'rtnDefault' is false.rtnDefault - True to return the first constant if integer value was not found and 'dft' is null.
public static <T extends java.lang.Enum<T>> T getValueOf(java.lang.Class<T> enumClass,
T value)
enumClass - The Class object of the enum type from which to return a constantvalue - The enum type value to return
public static <T extends java.lang.Enum<T>> T getValueOf(java.lang.Class<T> enumClass,
T value,
T dft)
enumClass - The Class object of the enum type from which to return a constantvalue - The enum type value to returndft - The default type to return if the integer value was not found, and 'rtnDefault' is false.
public static <T extends java.lang.Enum<T>> T getValueOf(java.lang.Class<T> enumClass,
T value,
T dft,
boolean rtnDefault)
enumClass - The Class object of the enum type from which to return a constantvalue - The enum type value to returndft - The default type to return if the enum type value is null, and 'rtnDefault' is false.rtnDefault - True to return the first constant if the enum type value was not found and 'dft' is null.
public static <T extends java.lang.Enum<T>> T[] getValuesForMask(java.lang.Class<T> enumClass,
long mask)
enumClass - The Class object of the enum type from which to return constantsmask - The bitmask
public static <T extends java.lang.Enum<T>> long getValueMask(java.lang.Class<T> enumClass)
enumClass - The Class object of the enum type from which to return the bitmask
public static void registerPublicEnumClasses(java.lang.Class<?> enumContainerClass)
enumContainerClass - The class which defined Enum inner classespublic static <T extends java.lang.Enum> void registerEnumClass(java.lang.Class<T> enumClass)
enumClass - The Enum class to register. The default name used in the registration
will be the name of the class with the package name removed.
public static <T extends java.lang.Enum> void registerEnumClass(java.lang.String name,
java.lang.Class<T> enumClass)
name - The name under which the Enum class will be registeredenumClass - The Enum class to register.public static java.lang.Class<? extends java.lang.Enum> getEnumClass(java.lang.String name)
name - The register Enum class name
public static java.lang.Class<? extends java.lang.Enum> getEnumClass(java.lang.Class enumContainerClass,
java.lang.String name)
enumContainerClass - The parent class in which the specified name is definedname - The register Enum class name
public static void main(java.lang.String[] argv)
argv - Comand-line arguments
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||