public class EnumUtil
extends java.lang.Object
Constructor and Description |
---|
EnumUtil() |
Modifier and Type | Method and Description |
---|---|
static <TYPE extends ValueEnum> |
getEnum(TYPE[] enums,
java.lang.String value)
Get a enum item by value.
|
static <TYPE extends ValueEnum> |
getEnums(TYPE[] enums,
java.lang.String[] values)
Deprecated.
use {
getEnums(ValueEnum[], String[], ValueEnum[])
method |
static <TYPE extends ValueEnum> |
getEnums(TYPE[] enums,
java.lang.String[] values,
TYPE[] result)
Get a enum items by values.
|
public static <TYPE extends ValueEnum> TYPE getEnum(TYPE[] enums, java.lang.String value)
enums
- - enum itemsvalue
- - enum valueValueEnum
public static <TYPE extends ValueEnum> TYPE[] getEnums(TYPE[] enums, java.lang.String[] values, TYPE[] result)
The java 1.6 does not support a code " (TYPE[]) new Object[values.length];". Also, the GWT does not support a reflection api ( {@link java.lang.reflect.Array#newInstance}). So you need to pass an array argument to store the result.
enums
- - enum itemsvalues
- - enum valuesresult
- - array to store the resultpublic static <TYPE extends ValueEnum> ValueEnum[] getEnums(TYPE[] enums, java.lang.String[] values)
getEnums(ValueEnum[], String[], ValueEnum[])
methodThis method is not compatible with the java 1.6.
enums
- - enum itemsvalues
- - enum valuesgetEnums(ValueEnum[], String[], ValueEnum[])