|
TUM CCSM Commons | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.tum.cs.commons.enums.EnumUtils
public class EnumUtils
Utility class for enumerations.
| Constructor Summary | |
|---|---|
EnumUtils()
|
|
| Method Summary | ||
|---|---|---|
static
|
stringValues(Class<T> enumType)
Returns an array containing the names of the enum element. |
|
static
|
valueOf(Class<T> enumType,
String constantName)
This works like Enum.valueOf(java.lang.Class, java.lang.String)
but returns null if constant wasn't found instead of
throwing an IllegalArgumentException. |
|
static
|
valueOfIgnoreCase(Class<T> enumType,
String constantName)
Works like valueOf(Class, String) but ignores case. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public EnumUtils()
| Method Detail |
|---|
public static <T extends Enum<T>> T valueOf(Class<T> enumType,
String constantName)
Enum.valueOf(java.lang.Class, java.lang.String)
but returns null if constant wasn't found instead of
throwing an IllegalArgumentException.
enumType - Enumeration classconstantName - name of the constant
null if not found
public static <T extends Enum<T>> T valueOfIgnoreCase(Class<T> enumType,
String constantName)
valueOf(Class, String) but ignores case.
Worst case runtime is O('number of constants in enum').
public static <T extends Enum<T>> String[] stringValues(Class<T> enumType)
|
TUM CCSM Commons | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||