Package org.cip4.jdflib.util
Class EnumUtil
- java.lang.Object
-
- org.cip4.jdflib.util.EnumUtil
-
public class EnumUtil extends java.lang.Objectclass with utilities for enums
-
-
Constructor Summary
Constructors Constructor Description EnumUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanaLessEqualsThanB(org.apache.commons.lang.enums.ValuedEnum a, org.apache.commons.lang.enums.ValuedEnum b)checks whether the value of an enum is less or equal to another
null is always smallerstatic booleanaLessThanB(org.apache.commons.lang.enums.ValuedEnum a, org.apache.commons.lang.enums.ValuedEnum b)checks whether the value of an enum is less than another
null is always smallerstatic org.apache.commons.lang.enums.ValuedEnumgetEnumIgnoreCase(java.lang.Class<? extends org.apache.commons.lang.enums.ValuedEnum> clazz, java.lang.Enum<?> e)get enum ignoring casestatic org.apache.commons.lang.enums.ValuedEnumgetEnumIgnoreCase(java.lang.Class<? extends org.apache.commons.lang.enums.ValuedEnum> clazz, java.lang.String s)static java.lang.StringgetEnumName(org.apache.commons.lang.enums.ValuedEnum en)null save convenience name getterstatic java.util.Vector<org.apache.commons.lang.enums.ValuedEnum>getEnumsVector(java.lang.Class<? extends org.apache.commons.lang.enums.ValuedEnum> e)get a vector of elements in an iterationstatic <T extends java.lang.Enum<T>>
TgetJavaEnumIgnoreCase(java.lang.Class<T> c, java.lang.String val)static java.lang.StringgetName(org.apache.commons.lang.enums.ValuedEnum en)null save convenience name getterstatic StringArraygetNamesList(java.lang.Class<? extends org.apache.commons.lang.enums.ValuedEnum> e)get a vector of names in an iterationstatic VStringgetNamesVector(java.lang.Class<? extends org.apache.commons.lang.enums.ValuedEnum> e)get a vector of names in an iterationstatic org.apache.commons.lang.enums.ValuedEnummax(org.apache.commons.lang.enums.ValuedEnum e1, org.apache.commons.lang.enums.ValuedEnum e2)get the higher of two enum values, null is loweststatic org.apache.commons.lang.enums.ValuedEnummin(org.apache.commons.lang.enums.ValuedEnum e1, org.apache.commons.lang.enums.ValuedEnum e2)get the lower of two enum values, null is lowest
-
-
-
Method Detail
-
getNamesVector
public static VString getNamesVector(java.lang.Class<? extends org.apache.commons.lang.enums.ValuedEnum> e)
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
public static StringArray getNamesList(java.lang.Class<? extends org.apache.commons.lang.enums.ValuedEnum> e)
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
public static java.util.Vector<org.apache.commons.lang.enums.ValuedEnum> getEnumsVector(java.lang.Class<? extends org.apache.commons.lang.enums.ValuedEnum> e)
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
public static org.apache.commons.lang.enums.ValuedEnum min(org.apache.commons.lang.enums.ValuedEnum e1, org.apache.commons.lang.enums.ValuedEnum e2)get the lower of two enum values, null is lowest- Parameters:
e1-e2-- Returns:
- the lower of the two values
-
max
public static org.apache.commons.lang.enums.ValuedEnum max(org.apache.commons.lang.enums.ValuedEnum e1, org.apache.commons.lang.enums.ValuedEnum 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(org.apache.commons.lang.enums.ValuedEnum en)
null save convenience name getter- Parameters:
en- the enum to get the name of the class- Returns:
-
getEnumName
public static java.lang.String getEnumName(org.apache.commons.lang.enums.ValuedEnum en)
null save convenience name getter- Parameters:
en- the enum to get the name- Returns:
-
aLessThanB
public static boolean aLessThanB(org.apache.commons.lang.enums.ValuedEnum a, org.apache.commons.lang.enums.ValuedEnum 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 boolean aLessEqualsThanB(org.apache.commons.lang.enums.ValuedEnum a, org.apache.commons.lang.enums.ValuedEnum 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 org.apache.commons.lang.enums.ValuedEnum getEnumIgnoreCase(java.lang.Class<? extends org.apache.commons.lang.enums.ValuedEnum> clazz, java.lang.Enum<?> e)get enum ignoring case- Parameters:
clazz- the jdflib valued enum classe- the enum- Returns:
-
getEnumIgnoreCase
public static org.apache.commons.lang.enums.ValuedEnum getEnumIgnoreCase(java.lang.Class<? extends org.apache.commons.lang.enums.ValuedEnum> clazz, java.lang.String s)- Parameters:
clazz-s-- Returns:
-
getJavaEnumIgnoreCase
public static <T extends java.lang.Enum<T>> T getJavaEnumIgnoreCase(java.lang.Class<T> c, java.lang.String val)- Type Parameters:
T-- Parameters:
val-c-- Returns:
-
-