Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Runtime

org.eclipse.gmf.runtime.common.core.util
Class EnumeratedType

java.lang.Object
  extended by 
org.eclipse.gmf.runtime.common.core.util.EnumeratedType
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
AbstractDropTargetListener.WorkIndicatorType, ClipboardState, ExecutionStrategy, GravityDirectionType, ProviderPriority

public abstract class EnumeratedType
extends java.lang.Object
implements java.io.Serializable

An enumeration of constants based on the typesafe enum pattern.

See Also:
Serialized Form

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

EnumeratedType

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++); }

Parameters:
name - The name of the new enumerated type.
ordinal - The ordinal for the new enumerated type.
Method Detail

getName

public java.lang.String getName()
Retrieves the value of the name instance variable.

Returns:
The value of the name instance variable.

getOrdinal

public final int getOrdinal()
Retrieves the value of the ordinal instance variable.

Returns:
The value of the ordinal instance variable.

getValues

protected abstract java.util.List getValues()
Retrieves the list of constants for this enumerated type.

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)); }

Returns:
The list of constants for this enumerated type.

equals

public final boolean equals(java.lang.Object object)
Indicates whether some other object is "equal to" this enumerated type.

Overrides:
equals in class java.lang.Object
Parameters:
object - The reference object with which to compare.
Returns:
true if this enumerated type is the same as the object argument; false otherwise.
See Also:
Object.equals(Object)

hashCode

public final int hashCode()
Retrieves a hash code value for this enumerated type. This method is supported for the benefit of hashtables such as those provided by java.util.Hashtable.

Overrides:
hashCode in class java.lang.Object
Returns:
A hash code value for this enumerated type.
See Also:
Object.hashCode()

toString

public java.lang.String toString()
Retrieves a textual representation of this enumerated type.

Overrides:
toString in class java.lang.Object
Returns:
A textual representation of this enumerated type.
See Also:
Object.toString()

readResolve

protected final java.lang.Object readResolve()
                                      throws java.io.ObjectStreamException
Designates an alternative object to be used when reading an enumerated type from a stream.

Returns:
The alternative enumerated type object.
Throws:
java.io.ObjectStreamException
See Also:
Serializable

Runtime

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp., Borland Software Corp., and others 2005,2006. All rights reserved.


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire