S
- Self bounding on the type of the enumeration class.public class Enumeration<S extends Enumeration<S>> extends java.lang.Object implements Self<S>
Modifier | Constructor and Description |
---|---|
protected |
Enumeration(java.lang.String name) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
static <T extends Enumeration> |
getConstants(java.lang.Class<T> enumerationClass) |
int |
hashCode() |
java.lang.String |
name() |
S |
next() |
static <E extends java.lang.Enum<?>> |
next(E item) |
int |
ordinal() |
static java.lang.String |
readableName(java.lang.Enum<?> enumItem) |
java.lang.String |
toString() |
static <T extends Enumeration<?>> |
valueOf(java.lang.Class<T> enumerationClass,
java.lang.String name)
Effectively a reimplementation of
valueOf(java.lang.Class<T>, java.lang.String) for the
Enumeration class. |
static <T extends java.lang.Enum<?>> |
valueOfEnum(java.lang.Class<T> enumerationClass,
java.lang.String name)
A reimplementation of
Enum.valueOf(java.lang.Class<T>, java.lang.String) with less pointlessly restrictive
generic bounds. |
public java.lang.String name()
public final boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public final int hashCode()
hashCode
in class java.lang.Object
public int ordinal()
public java.lang.String toString()
toString
in class java.lang.Object
public static <T extends Enumeration> java.util.List<T> getConstants(java.lang.Class<T> enumerationClass)
T
- The Enumeration
class.enumerationClass
- An Enumeration class for which to retrieve all declared constants.public static <T extends Enumeration<?>> T valueOf(java.lang.Class<T> enumerationClass, java.lang.String name)
valueOf(java.lang.Class<T>, java.lang.String)
for the
Enumeration class.T
- The Enumeration
class.enumerationClass
- The class of Enumeration we wish to retrieve an instance of.name
- The name of the instance to retrieve.public static <T extends java.lang.Enum<?>> T valueOfEnum(java.lang.Class<T> enumerationClass, java.lang.String name)
Enum.valueOf(java.lang.Class<T>, java.lang.String)
with less pointlessly restrictive
generic bounds.T
- The Enum
class.enumerationClass
- The class of Enum we wish to retrieve an instance of.name
- The name of the instance to retrieve.public static java.lang.String readableName(java.lang.Enum<?> enumItem)
enumItem
- an enumeration item to make readable, by substituting underscores
with spaces, and properly capitalizingpublic S next()
public static <E extends java.lang.Enum<?>> E next(E item)
E
- the type of the given enum itemitem
- the enum item we wish to find the next in the sequence from