dsto.dfc.util
Class AbstractEnumerationValue

java.lang.Object
  extended by dsto.dfc.util.AbstractEnumerationValue
All Implemented Interfaces:
EnumerationValue, Serializable
Direct Known Subclasses:
StringEnumerationValue

public abstract class AbstractEnumerationValue
extends Object
implements EnumerationValue, Serializable

Base class for enumerated types. Provides sensible default for equals() as well as intelligent serialization support via a readResolve () that resolves serialized enum values to their equivalent singleton instance in getEnumValues (). Superclasses that wish to use this feature must provide a readResolve() implementation that calls super.readResolve().

Version:
$Revision$
See Also:
Serialized Form

Constructor Summary
AbstractEnumerationValue()
           
 
Method Summary
 boolean equals(Object o)
           
 int findIndex()
           
static int findIndex(EnumerationValue value)
           
abstract  EnumerationValue[] getEnumValues()
          Get the list of values within the enumeration.
protected  Object readResolve()
          Serialization support: resolves instance written to stream to the equivalent instance in getEnumValues () using equals ().
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractEnumerationValue

public AbstractEnumerationValue()
Method Detail

getEnumValues

public abstract EnumerationValue[] getEnumValues()
Description copied from interface: EnumerationValue
Get the list of values within the enumeration.

Specified by:
getEnumValues in interface EnumerationValue

equals

public boolean equals(Object o)
Overrides:
equals in class Object

findIndex

public int findIndex()

findIndex

public static int findIndex(EnumerationValue value)

readResolve

protected Object readResolve()
                      throws InvalidObjectException
Serialization support: resolves instance written to stream to the equivalent instance in getEnumValues () using equals (). Superclasses that wish to use this feature must override this method and call super.readResolve ().

Throws:
InvalidObjectException - if value could not be resolved to a valid entry in the list of enum values.


Copyright © 2008 Commonwealth of Australia