|
Runtime | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.eclipse.gmf.runtime.common.core.util.EnumeratedType
public abstract class EnumeratedType
An enumeration of constants based on the typesafe enum pattern.
| Constructor Summary | |
|---|---|
protected |
EnumeratedType(java.lang.String name,
int ordinal)
Concrete subclasses should define a private static field to generate ordinals and a private constructor as follows:
private static int nextOrdinal = 0;
private Subclass(String name) {
super(name, nextOrdinal++);
}
|
| Method Summary | |
|---|---|
boolean |
equals(java.lang.Object object)
Indicates whether some other object is "equal to" this enumerated type. |
java.lang.String |
getName()
Retrieves the value of the name instance variable. |
int |
getOrdinal()
Retrieves the value of the ordinal instance variable. |
protected abstract java.util.List |
getValues()
Retrieves the list of constants for this enumerated type. |
int |
hashCode()
Retrieves a hash code value for this enumerated type. |
protected java.lang.Object |
readResolve()
Designates an alternative object to be used when reading an enumerated type from a stream. |
java.lang.String |
toString()
Retrieves a textual representation of this enumerated type. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
protected EnumeratedType(java.lang.String name,
int ordinal)
private static int nextOrdinal = 0;
private Subclass(String name) {
super(name, nextOrdinal++);
}
name - The name of the new enumerated type.ordinal - The ordinal for the new enumerated type.| Method Detail |
|---|
public java.lang.String getName()
name instance variable.
name instance variable.public final int getOrdinal()
ordinal instance variable.
ordinal instance variable.protected abstract java.util.List getValues()
Concrete subclasses should define a private static array of values and a(n) (final) implementation of this method as follows:
private static final Subclass[] VALUES = { ... };
protected final List getValues() {
return Collections.unmodifiableList(Arrays.asList(VALUES));
}
public final boolean equals(java.lang.Object object)
equals in class java.lang.Objectobject - The reference object with which to compare.
true if this enumerated type is the same as the
object argument; false otherwise.Object.equals(Object)public final int hashCode()
java.util.Hashtable.
hashCode in class java.lang.ObjectObject.hashCode()public java.lang.String toString()
toString in class java.lang.ObjectObject.toString()
protected final java.lang.Object readResolve()
throws java.io.ObjectStreamException
java.io.ObjectStreamExceptionSerializable
|
Runtime | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp., Borland Software Corp., and others 2005,2006. All rights reserved.