public class EnumUtils
extends java.lang.Object
Constructor and Description |
---|
EnumUtils() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String[] |
getNames(java.lang.Class<? extends java.lang.Enum<?>> e)
Return an array of Strings of all the enum levels.
|
static <T extends java.lang.Enum<T>> |
valueOf(java.lang.Class<T> clz,
java.lang.String name)
This is like Enum.valueOf() only better: it matches enum constants very loosely: case-insensitive and disregarding
any non-alphanumeric characters (e.g.
|
static <T extends java.lang.Enum<?>> |
valueOfIgnoreCase(java.lang.Class<T> enumeration,
java.lang.String value) |
public static java.lang.String[] getNames(java.lang.Class<? extends java.lang.Enum<?>> e)
Taken from http://stackoverflow.com/questions/13783295/getting-all-names-in-an-enum-as-a-string.
public static <T extends java.lang.Enum<T>> T valueOf(java.lang.Class<T> clz, java.lang.String name)
T
- The enum type whose constant is to be returnedclz
- the Class
object of the enum type from which to return a constantname
- the name of the constant to returnpublic static <T extends java.lang.Enum<?>> java.util.Optional<T> valueOfIgnoreCase(java.lang.Class<T> enumeration, java.lang.String value)
T
- Class of the Enumeration to search inenumeration
- Enumeration to search invalue
- String to search fore