aicas logoJamaica 6.4 release 1

java.lang
Class Enum<E extends Enum<E>>

java.lang.Object
  extended by java.lang.Enum<E>
All Implemented Interfaces:
Serializable, Comparable<E>

public abstract class Enum<E extends Enum<E>>
extends Object
implements Serializable, Comparable<E>

Enum provides the abstract super class for all JDK 1.5 enumeration types.

Since:
1.5
See Also:
Serialized Form

Constructor Summary
protected Enum(String name, int ordinal)
          Constructor for one enumaration constant.
 
Method Summary
protected  Object clone()
          clone is not supported by enumerations, this throws a CloneNotSupportedException.
 int compareTo(E e)
          compareTo compares two Enum constants from the same enumeration.
 boolean equals(Object o)
          equals returns true if this and o refer to the same constant for the same enumeration.
protected  void finalize()
          Default finalizer that ensures that Enums will not be declared with a finalize method.
 Class<E> getDeclaringClass()
          getDeclaringClass returns the type that declared this enumeration constant.
 int hashCode()
          hashCode returns a hashcode for this constant.
 String name()
          name return the identifier name of this enumeration constant.
 int ordinal()
          ordinal returns the ordinal value of this enumeration element.
 String toString()
          toString returns the name of this constant.
static
<T extends Enum<T>>
T
valueOf(Class<T> enumType, String name)
          valueOf returns the Enum value with a given name
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Enum

protected Enum(String name,
               int ordinal)
Constructor for one enumaration constant.

Parameters:
name - the name of the constant.
ordinal - the ordinal value of the constant.
Since:
1.5
Method Detail

clone

protected final Object clone()
                      throws CloneNotSupportedException
clone is not supported by enumerations, this throws a CloneNotSupportedException.

Overrides:
clone in class Object
Returns:
never returns anything.
Throws:
CloneNotSupportedException - in any case.
Since:
1.5

compareTo

public final int compareTo(E e)
compareTo compares two Enum constants from the same enumeration. The first entry in the enumeration is the smallest.

Specified by:
compareTo in interface Comparable<E extends Enum<E>>
Parameters:
e - the other Enum.
Returns:
-1, 0, or 1 if this is less, equal, or larger than o.
Since:
1.5

equals

public final boolean equals(Object o)
equals returns true if this and o refer to the same constant for the same enumeration.

Overrides:
equals in class Object
Parameters:
o - the other enumeration.
Returns:
true iff this and o are equal.
Since:
1.5

getDeclaringClass

public final Class<E> getDeclaringClass()
getDeclaringClass returns the type that declared this enumeration constant. Two constants belong to the same enumeration iff they have the same declaring class.

Returns:
the type of the declaration of this constant.
Since:
1.5

hashCode

public final int hashCode()
hashCode returns a hashcode for this constant.

Overrides:
hashCode in class Object
Returns:
the hashcode.
Since:
1.5

name

public final String name()
name return the identifier name of this enumeration constant.

Returns:
the name.
Since:
1.5

ordinal

public final int ordinal()
ordinal returns the ordinal value of this enumeration element. The ordinal values are 0, 1, 2, etc. for the first, second, third, etc. constant.

Returns:
the ordinal value.
Since:
1.5

toString

public String toString()
toString returns the name of this constant.

Overrides:
toString in class Object
Returns:
the name.
Since:
1.5

valueOf

public static <T extends Enum<T>> T valueOf(Class<T> enumType,
                                            String name)
valueOf returns the Enum value with a given name

Parameters:
enumType - the enum type we request a value from
name - the name of the enum value
Returns:
the enum value
Throws:
IllegalArgumentException - if name is not the name of any enum value in enumType
NullPointerException - if enumType of name is null.
Since:
1.5

finalize

protected final void finalize()
Default finalizer that ensures that Enums will not be declared with a finalize method.

Overrides:
finalize in class Object

aicas logoJamaica 6.4 release 1

aicas GmbH, Karlsruhe, Germany —www.aicas.com
Copyright © 2001-2015 aicas GmbH. All Rights Reserved.