Package org.cip4.jdflib.util
Class EnumUtil
java.lang.Object
org.cip4.jdflib.util.EnumUtil
class with utilities for enums
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanchecks whether the value of an enum is less or equal to another
null is always smallerstatic booleanaLessThanB(ValuedEnum a, ValuedEnum b) checks whether the value of an enum is less than another
null is always smallerstatic <T extends Enum<T>>
TgetEnum(Class<T> c, ValuedEnum val) static ValuedEnumgetEnumIgnoreCase(Class<? extends ValuedEnum> clazz, Enum<?> e) get enum ignoring casestatic ValuedEnumgetEnumIgnoreCase(Class<? extends ValuedEnum> clazz, String s) static Stringnull save convenience name getterstatic Vector<ValuedEnum>getEnumsVector(Class<? extends ValuedEnum> e) get a vector of elements in an iterationstatic <T extends Enum<T>>
TgetJavaEnum(ValuedEnum val) static <T extends Enum<T>>
TgetJavaEnumIgnoreCase(Class<T> c, String val) static StringgetName(ValuedEnum en) null save convenience name getterstatic StringArraygetNamesList(Class<? extends ValuedEnum> e) get a vector of names in an iterationstatic VStringgetNamesVector(Class<? extends ValuedEnum> e) get a vector of names in an iterationstatic <T extends ValuedEnum,E extends Enum<E>>
TgetOldEnum(E val) static <O extends ValuedEnum,E extends Enum<E>>
Class<O>getOldEnumClass(Enum<E> oldEnum) static intstatic ValuedEnummax(ValuedEnum e1, ValuedEnum e2) get the higher of two enum values, null is loweststatic ValuedEnummin(ValuedEnum e1, ValuedEnum e2) get the lower of two enum values, null is lowest
-
Method Details
-
getNamesVector
get a vector of names in an iteration- Parameters:
e- any member of the enum to iterate over- Returns:
- VString - the vector of enum names
-
getNamesList
get a vector of names in an iteration- Parameters:
e- any member of the enum to iterate over- Returns:
- VString - the vector of enum names
-
getEnumsVector
get a vector of elements in an iteration- Parameters:
e- any member of the enum to iterate over- Returns:
- Vector - the vector of enum instances
-
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 save convenience name getter- Parameters:
en- the enum to get the name of the class- Returns:
-
getEnumName
null save convenience name getter- Parameters:
en- the enum to get the name- 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
-
getValue
-
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
get enum ignoring case- Parameters:
clazz- the jdflib valued enum classe- the enum- Returns:
-
getEnum
- Type Parameters:
T-- Parameters:
c-val-def- the default- Returns:
-
getEnumIgnoreCase
- Parameters:
clazz-s-- Returns:
-
getJavaEnumIgnoreCase
- Type Parameters:
T-- Parameters:
val-c-- Returns:
-
getJavaEnum
- Type Parameters:
T-T-- Parameters:
val-c-- Returns:
-
getJavaEnumClass
- Type Parameters:
J-J-- Parameters:
val-c-- Returns:
-
getOldEnum
- Type Parameters:
T-T-- Parameters:
val-c-- Returns:
-
getOldEnumClass
- Type Parameters:
O-O-E-- Parameters:
oldEnum-c-- Returns:
-