Package org.cip4.jdflib.util
Class JavaEnumUtil
java.lang.Object
org.cip4.jdflib.util.JavaEnumUtil
class with utilities for enums
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends 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 Enum<T>>
booleanaLessThanB(T a, T b) checks whether the value of an enum is less than another
null is always smallerstatic <T extends Enum<T>>
TgetEnumIgnoreCase(Class<T> c, String val) static <T extends Enum<T>>
TgetEnumIgnoreCase(Class<T> c, String val, T def) getEnumList(Class<T> c, String strings, boolean unique) null safe convenience name list gettergetEnumList(Class<T> c, Collection<String> strings, boolean unique) null safe convenience name list getterstatic Stringnull safe convenience name getterstatic <T extends Enum<T>>
StringArraygetNameList(Collection<T> esn, boolean unique) null safe convenience name list gettergetNamesList(Class<T> c) static <T extends Enum<T>>
Tmax(T e1, T e2) get the higher of two enum values, null is loweststatic <T extends Enum<T>>
Tmin(T e1, T e2) get the lower of two enum values, null is lowest
-
Method Details
-
min
get the lower of two enum values, null is lowest- Parameters:
e1-e2-- Returns:
- the lower of the two values
-
max
get the higher of two enum values, null is lowest- Parameters:
e1-e2-- Returns:
- the higher of the two values
-
getName
null safe convenience name getter- Parameters:
en- the enum to get the name of the class- Returns:
-
aLessThanB
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
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
- Type Parameters:
T-- Parameters:
val-c-- Returns:
-
getEnumIgnoreCase
- Type Parameters:
T-- Parameters:
c-val-def- the default- Returns:
-
getNamesList
- Type Parameters:
T-- Parameters:
c-- Returns:
-
getNameList
null safe convenience name list getter- Parameters:
esn- the enum collection to get the list of names- Returns:
-
getEnumList
public static <T extends Enum<T>> List<T> getEnumList(Class<T> c, Collection<String> strings, boolean unique) null safe convenience name list getter- Parameters:
esn- the enum collection to get the list of names- Returns:
-
getEnumList
null safe convenience name list getter- Parameters:
esn- the enum collection to get the list of names- Returns:
-