Package org.cip4.jdflib.util
Class JavaEnumUtil
- java.lang.Object
-
- org.cip4.jdflib.util.JavaEnumUtil
-
public class JavaEnumUtil extends java.lang.Objectclass with utilities for enums
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T extends java.lang.Enum<T>>
booleanaLessEqualsThanB(T a, T b)checks whether the value of an enum is less or equal to another
null is always smallerstatic <T extends java.lang.Enum<T>>
booleanaLessThanB(T a, T b)checks whether the value of an enum is less than another
null is always smallerstatic <T extends java.lang.Enum<T>>
TgetEnumIgnoreCase(java.lang.Class<T> c, java.lang.String val)static <T extends java.lang.Enum<T>>
TgetEnumIgnoreCase(java.lang.Class<T> c, java.lang.String val, T def)static java.lang.StringgetName(java.lang.Enum<?> en)null safe convenience name getterstatic <T extends java.lang.Enum<T>>
java.util.List<java.lang.String>getNamesList(java.lang.Class<T> c)static <T extends java.lang.Enum<T>>
Tmax(T e1, T e2)get the higher of two enum values, null is loweststatic <T extends java.lang.Enum<T>>
Tmin(T e1, T e2)get the lower of two enum values, null is lowest
-
-
-
Method Detail
-
min
public static <T extends java.lang.Enum<T>> T min(T e1, T e2)get the lower of two enum values, null is lowest- Parameters:
e1-e2-- Returns:
- the lower of the two values
-
max
public static <T extends java.lang.Enum<T>> T max(T e1, T e2)get the higher of two enum values, null is lowest- Parameters:
e1-e2-- Returns:
- the higher of the two values
-
getName
public static java.lang.String getName(java.lang.Enum<?> en)
null safe convenience name getter- Parameters:
en- the enum to get the name of the class- Returns:
-
aLessThanB
public static <T extends java.lang.Enum<T>> boolean aLessThanB(T a, T b)checks whether the value of an enum is less than another
null is always smaller- Parameters:
a- the first enum; if this is smaller we return trueb- the second enum- Returns:
- boolean a is < b
-
aLessEqualsThanB
public static <T extends java.lang.Enum<T>> boolean aLessEqualsThanB(T a, T b)checks whether the value of an enum is less or equal to another
null is always smaller- Parameters:
a- the first enum; if this is smaller we return trueb- the second enum- Returns:
- boolean a is <= b
-
getEnumIgnoreCase
public static <T extends java.lang.Enum<T>> T getEnumIgnoreCase(java.lang.Class<T> c, java.lang.String val)- Type Parameters:
T-- Parameters:
val-c-- Returns:
-
getEnumIgnoreCase
public static <T extends java.lang.Enum<T>> T getEnumIgnoreCase(java.lang.Class<T> c, java.lang.String val, T def)- Type Parameters:
T-- Parameters:
c-val-def- the default- Returns:
-
getNamesList
public static <T extends java.lang.Enum<T>> java.util.List<java.lang.String> getNamesList(java.lang.Class<T> c)
- Type Parameters:
T-- Parameters:
c-- Returns:
-
-