org.jboss.lang
Class EnumImpl<E extends EnumImpl<E>>

java.lang.Object
  extended by org.jboss.lang.EnumImpl<E>
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<E>

public abstract class EnumImpl<E extends EnumImpl<E>>
extends java.lang.Object
implements java.io.Serializable, java.lang.Comparable<E>

Mapping of the java.lang.Enum.

See Also:
Serialized Form

Constructor Summary
protected EnumImpl(java.lang.String name, int ordinal)
          Create an enum type.
 
Method Summary
protected  java.lang.Object clone()
           
 int compareTo(E o)
           
 boolean equals(java.lang.Object other)
           
 java.lang.Class<E> getDeclaringClass()
           
 int hashCode()
           
 java.lang.String name()
           
 int ordinal()
           
 java.lang.String toString()
           
static
<T extends EnumImpl<T>>
T
valueOf(java.lang.Class<T> enumType, java.lang.String name)
          Obtain the Enum of enumType for the given name.
static
<T extends EnumImpl<T>>
T[]
values(java.lang.Class<T> enumType)
          Obtain the array of Enums for enumType.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EnumImpl

protected EnumImpl(java.lang.String name,
                   int ordinal)
Create an enum type. This registers the enum with the class enumConstants to support the valueOf, values methods.

Parameters:
name - - the string representation of the enum
ordinal - - the int representation of the enum
See Also:
Weaver.rewriteEnum(ClassLoader, CompilerClassInfo)
Method Detail

valueOf

public static <T extends EnumImpl<T>> T valueOf(java.lang.Class<T> enumType,
                                                java.lang.String name)
Obtain the Enum of enumType for the given name.

Parameters:
enumType - - the class for the enum type
name - - the string representation of the enum type
Returns:
the T enum type if found, null otherwise

values

public static <T extends EnumImpl<T>> T[] values(java.lang.Class<T> enumType)
Obtain the array of Enums for enumType.

Parameters:
enumType - - the class for the enum type
Returns:
the T[] enum types if enumType is a registered type, null otherwise

name

public final java.lang.String name()

ordinal

public final int ordinal()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

equals

public final boolean equals(java.lang.Object other)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

compareTo

public final int compareTo(E o)
Specified by:
compareTo in interface java.lang.Comparable<E extends EnumImpl<E>>

clone

protected final java.lang.Object clone()
                                throws java.lang.CloneNotSupportedException
Overrides:
clone in class java.lang.Object
Throws:
java.lang.CloneNotSupportedException

getDeclaringClass

public final java.lang.Class<E> getDeclaringClass()