com.waveset.util
Class Enum

java.lang.Object
  extended bycom.waveset.util.Enum
All Implemented Interfaces:
java.lang.Comparable
Direct Known Subclasses:
MetaEvent.Type, Provisioner.ProvisionOp, WorkflowValidator.Property, WorkflowValidator.Severity

public abstract class Enum
extends java.lang.Object
implements java.lang.Comparable

Convenient base class for enumerated types. To use this class you must extend it and make the class **final**.


Constructor Summary
protected Enum(java.lang.String name, java.lang.String displayName, java.lang.Integer ordinal)
          Creates a new enumerated object.
 
Method Summary
 int compareTo(java.lang.Object o)
          Compares two enums of the same enumerated type based on their ordinal.
 boolean equals(java.lang.Object o)
          All enums should be identity comparable.
 java.lang.String getDisplayName()
          Returns the display name of the Enum.
static Enum getEnumByName(java.lang.Class clazz, java.lang.String name)
          Looks up an enumerated object for a given enumerated class.
static java.util.List getEnums(java.lang.Class clazz)
          Given an enumerated class, returns the enums of that class, sorted by their ordinal.
 java.lang.String getName()
          Returns the name of the Enum.
 int getOrdinal()
          Returns the ordinal value of the Enum.
 int hashCode()
          All enums should be identity comparable.
 java.lang.String toString()
          Returns the string suitable for debugging purposes.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Enum

protected Enum(java.lang.String name,
               java.lang.String displayName,
               java.lang.Integer ordinal)
Creates a new enumerated object.

Parameters:
name - The name of the enumerated object.
displayName - The localized message tag.
ordinal - The ordinal of the enum. If null will automatically be set to 1 plus the previous for a given Enum class.
Method Detail

getEnumByName

public static Enum getEnumByName(java.lang.Class clazz,
                                 java.lang.String name)
Looks up an enumerated object for a given enumerated class.


getEnums

public static java.util.List getEnums(java.lang.Class clazz)
Given an enumerated class, returns the enums of that class, sorted by their ordinal. The resulting list will be immutable.


getName

public final java.lang.String getName()
Returns the name of the Enum.


getDisplayName

public final java.lang.String getDisplayName()
Returns the display name of the Enum.


getOrdinal

public final int getOrdinal()
Returns the ordinal value of the Enum.


toString

public java.lang.String toString()
Returns the string suitable for debugging purposes.


equals

public final boolean equals(java.lang.Object o)
All enums should be identity comparable.


hashCode

public final int hashCode()
All enums should be identity comparable.


compareTo

public final int compareTo(java.lang.Object o)
Compares two enums of the same enumerated type based on their ordinal. Enums of different types are not comparable.

Specified by:
compareTo in interface java.lang.Comparable