|
ehsbe CommonsTM Version 1.1.0rc3 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.ehsbe.commons.util.EnumUtils
public class EnumUtils
Utily collection for Enums. If not explict mentioned, the method works on regular enums (max. 64 values), only.
| Constructor Summary | |
|---|---|
EnumUtils()
|
|
| Method Summary | ||
|---|---|---|
static
|
convert(Class<E> targetType,
EnumSet<? extends Enum<?>> src,
boolean ignoreUnknown)
Convert the given enum set to a enum set of the given targetType. |
|
static
|
difference(Class<E> enumType,
long mask1,
long mask2)
Get the difference between two enum sets represented by the given masks. |
|
static
|
getArray(Class<E> elementType,
byte mask)
Get the enum set, which corresponds to the given mask and types. |
|
static
|
getArray(Class<E> elementType,
int mask)
Get the enum set, which corresponds to the given mask and types. |
|
static
|
getArray(Class<E> elementType,
long mask)
Get the enum set, which corresponds to the given mask and types. |
|
static
|
getArray(Class<E> elementType,
short mask)
Get the enum set, which corresponds to the given mask and types. |
|
static
|
getByteMask(EnumSet<E> eset)
Get the mask, which corresponds to the given enum set. |
|
static
|
getEnum(Class<E> elementType,
int ordinal)
Get an enum by its ordinal value. |
|
static
|
getIntMask(EnumSet<E> eset)
Get the mask, which corresponds to the given enum set. |
|
static
|
getMask(EnumSet<E> eset)
Get the mask, which corresponds to the given enum set. |
|
static
|
getSet(Class<E> elementType,
byte mask)
Get the enum set, which corresponds to the given mask and types. |
|
static
|
getSet(Class<E> elementType,
int mask)
Get the enum set, which corresponds to the given mask and types. |
|
static
|
getSet(Class<E> elementType,
long mask)
Get the enum set, which corresponds to the given mask and types. |
|
static
|
getSet(Class<E> elementType,
short mask)
Get the enum set, which corresponds to the given mask and types. |
|
static
|
getShortMask(EnumSet<E> eset)
Get the mask, which corresponds to the given enum set. |
|
static
|
isDeprecated(E element)
Check, whether the given enum element is deprecated. |
|
static
|
removeDeprecated(EnumSet<E> set)
Remove all values from the given set, which have a Deprecated annotation. |
|
| 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 <E extends Enum<E>> long getMask(EnumSet<E> eset)
E - the enumeration type of the seteset - the set, for whome a mask should be created.
0 if the given set is empty or null,
the mask otherwise.public static <E extends Enum<E>> int getIntMask(EnumSet<E> eset)
E - the enumeration type of the seteset - the set, for whome a mask should be created.
0 if the given set is empty or null,
the mask otherwise.public static <E extends Enum<E>> short getShortMask(EnumSet<E> eset)
E - the enumeration type of the seteset - the set, for whome a mask should be created.
0 if the given set is empty or null,
the mask otherwise.public static <E extends Enum<E>> byte getByteMask(EnumSet<E> eset)
E - the enumeration type of the seteset - the set, for whome a mask should be created.
0 if the given set is empty or null,
the mask otherwise.
public static <E extends Enum<E>> EnumSet<E> getSet(Class<E> elementType,
long mask)
E - the enumeration type of the elementelementType - the enumeration class, which corresponds to the maskmask - the mask to use to create the enum set.
IllegalArgumentException - if the given elementType
is null.
public static <E extends Enum<E>> E getEnum(Class<E> elementType,
int ordinal)
E - enum typeelementType - enum class to lookupordinal - ordinal value of the enum to be searched
null if the ordinal value is out of range, the
appropriate enum otherwise.
public static <E extends Enum<E>> EnumSet<E> getSet(Class<E> elementType,
byte mask)
E - the enumeration type of the elementelementType - the enumeration class, which corresponds to the maskmask - the mask to use to create the enum set.
IllegalArgumentException - if the given elementType
is null.
public static <E extends Enum<E>> EnumSet<E> getSet(Class<E> elementType,
short mask)
E - the enumeration type of the elementelementType - the enumeration class, which corresponds to the maskmask - the mask to use to create the enum set.
IllegalArgumentException - if the given elementType
is null.
public static <E extends Enum<E>> EnumSet<E> getSet(Class<E> elementType,
int mask)
E - the enumeration type of the elementelementType - the enumeration class, which corresponds to the maskmask - the mask to use to create the enum set.
IllegalArgumentException - if the given elementType
is null.
public static <E extends Enum<E>> Enum<?>[] getArray(Class<E> elementType,
long mask)
E - the enumeration type of the elementelementType - the enumeration class, which corresponds to the maskmask - the mask to use to create the enum set.
IllegalArgumentException - if the given elementType
is null.
public static <E extends Enum<E>> Enum<?>[] getArray(Class<E> elementType,
byte mask)
E - the enumeration type of the elementelementType - the enumeration class, which corresponds to the maskmask - the mask to use to create the enum set.
IllegalArgumentException - if the given elementType
is null.
public static <E extends Enum<E>> Enum<?>[] getArray(Class<E> elementType,
short mask)
E - the enumeration type of the elementelementType - the enumeration class, which corresponds to the maskmask - the mask to use to create the enum set.
IllegalArgumentException - if the given elementType
is null.
public static <E extends Enum<E>> Enum<?>[] getArray(Class<E> elementType,
int mask)
E - the enumeration type of the elementelementType - the enumeration class, which corresponds to the maskmask - the mask to use to create the enum set.
IllegalArgumentException - if the given elementType
is null.
public static <E extends Enum<E>> EnumSet<E> convert(Class<E> targetType,
EnumSet<? extends Enum<?>> src,
boolean ignoreUnknown)
true.
Otherwise an IllegalArgumentException will be thrown.
E - the type of the target enum.targetType - the element class of the returned enum setsrc - value to be convertedignoreUnknown - if true, ignore values, which are not
convertable, i.e. target has no value with the same name.
IllegalArgumentException - if the targetType is
null OR ignoreUnknwon is set and an
unconvertable value is encountered.public static <E extends Enum<E>> boolean isDeprecated(E element)
E - type of the enumelement - element of an enum
true, if the element is deprecated.public static <E extends Enum<E>> void removeDeprecated(EnumSet<E> set)
Deprecated annotation.
E - the type of the elements in the setset - set to check.
public static <E extends Enum<E>> EnumSet<E> difference(Class<E> enumType,
long mask1,
long mask2)
E - type of the elements in the setenumType - class of the elements in the setmask1 - mask of the first setmask2 - mask to substract
|
ehsbe CommonsTM Version 1.1.0rc3 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||