public abstract class Enum4D<T extends Enum4D<T>>
extends java.lang.Object
implements java.lang.Comparable<T>
Modifier | Constructor and Description |
---|---|
protected |
Enum4D(java.lang.String name,
int ordinal)
This constructor is used by the compiler to create enumeration constants.
|
Modifier and Type | Method and Description |
---|---|
protected java.lang.Object |
clone()
Cloning of enumeration constants is prevented, to maintain their
singleton status.
|
int |
compareTo(T e)
Returns an integer which represents the relative ordering of this
enumeration constant.
|
boolean |
equals(java.lang.Object o)
Returns true if this enumeration is equivalent to the supplied object,
o . |
protected void |
finalize()
Enumerations can not have finalization methods.
|
java.lang.Class<T> |
getDeclaringClass()
Returns the type of this enumeration constant.
|
int |
hashCode()
Returns the hash code of this constant.
|
java.lang.String |
name()
Returns the name of this enumeration constant.
|
int |
ordinal()
Returns the number of this enumeration constant, which represents
the order in which it was originally declared, starting from zero.
|
java.lang.String |
toString()
Returns a textual representation of this enumeration constant.
|
static <T extends Enum4D<T>> |
valueOf(java.lang.Class<T> enumType,
java.lang.String name) |
protected Enum4D(java.lang.String name, int ordinal)
name
- the name of the enumeration constant.ordinal
- the number of the enumeration constant, based on the
declaration order of the constants and starting from zero.public final boolean equals(java.lang.Object o)
o
. Only one instance of an enumeration constant exists,
so the comparison is simply done using ==
.equals
in class java.lang.Object
o
- the object to compare to this.this == o
.public final int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public final int compareTo(T e)
compareTo
in interface java.lang.Comparable<T extends Enum4D<T>>
e
- the enumeration constant to compare.e.ordinal < this.ordinal
,
zero if e.ordinal == this.ordinal
and a positive
integer if e.ordinal > this.ordinal
.java.lang.ClassCastException
- if e
is not an enumeration
constant of the same class.protected final java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
- as enumeration constants can't be
cloned.public final java.lang.String name()
public final int ordinal()
public final java.lang.Class<T> getDeclaringClass()
protected final void finalize()
finalize
in class java.lang.Object
public static <T extends Enum4D<T>> T valueOf(java.lang.Class<T> enumType, java.lang.String name)