csli.util
Class Enum
java.lang.Object
csli.util.Enum
public class Enum
- extends Object
A model for defining an enumeration class. To create your own enum class, use
the code templates below in Eclipse, or copy+paste+modify them appropriately.
- Author:
- Danilo Mirkovic
|
Constructor Summary |
Enum()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Enum
public Enum()
intEnumToString
public static String intEnumToString(Class ernumer,
int value)
- Attempts to convert an int enumerated value to a string. Conflicts might
occur if there are multiple public static final int field with the same
value within the class. In this case, we return the first one.
create
public static Object create(Class enumer,
String value)
- Creates an enum value from a string. Returns the object equal to the
public static final field of the class with the same name as the passed
string (case insensitive match). Returns null if it cannot match the
field.
- Parameters:
c - class of the enum (e.g. "Color")value - name of the enum value (e.g. "BLUE")
- Returns:
- the acutal enum object (e.g. Color.BLUE object).
main
public static void main(String[] args)