org.eigenbase.util14
Class Enum14.SerializableValue

java.lang.Object
  extended by org.eigenbase.util14.Enum14.BasicValue
      extended by org.eigenbase.util14.Enum14.SerializableValue
All Implemented Interfaces:
Serializable, Comparable, Enum14.Value
Direct Known Subclasses:
UtilTest.SerializableEnum
Enclosing class:
Enum14

public abstract static class Enum14.SerializableValue
extends Enum14.BasicValue
implements Serializable

SerializableValue extends BasicValue to provide better support for serializable subclasses. Instances of SerializableValue will deserialize into members of the original enumeration so that deserializedBasicValue == origBasicValue will be true.

See Also:
Serialized Form

Field Summary
protected  int _ordinal
          Ordinal value which, when deserialized, can be used by readResolve() to locate a matching instance in the original enumeration.
private static long serialVersionUID
          SerialVersionUID created with JDK 1.5 serialver tool.
 
Constructor Summary
Enum14.SerializableValue(String name, int ordinal, String description)
          Creates a new SerializableValue.
 
Method Summary
private  void readObject(ObjectInputStream in)
          Deserialization method reads the _ordinal value.
protected abstract  Object readResolve()
          Subclass must implement this method to retrieve a matching instance based on the _ordinal deserialized by readObject(java.io.ObjectInputStream).
private  void writeObject(ObjectOutputStream out)
          Serialization method writes just the ordinal value.
 
Methods inherited from class org.eigenbase.util14.Enum14.BasicValue
compareTo, equals, equals, getDescription, getName, getOrdinal, hashCode, toString, unexpected
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
SerialVersionUID created with JDK 1.5 serialver tool.

See Also:
Constant Field Values

_ordinal

protected int _ordinal
Ordinal value which, when deserialized, can be used by readResolve() to locate a matching instance in the original enumeration.

Constructor Detail

Enum14.SerializableValue

public Enum14.SerializableValue(String name,
                                int ordinal,
                                String description)
Creates a new SerializableValue.

Method Detail

readResolve

protected abstract Object readResolve()
                               throws ObjectStreamException
Subclass must implement this method to retrieve a matching instance based on the _ordinal deserialized by readObject(java.io.ObjectInputStream). This would typically be an instance from the original enumeration. Current instance is the candidate object deserialized from the ObjectInputStream. It is incomplete, cannot be used as-is, and this method must return a valid replacement. For example,
return SqlTypeName.get(_ordinal);

Returns:
replacement instance that matches _ordinal
Throws:
ObjectStreamException

readObject

private void readObject(ObjectInputStream in)
                 throws IOException
Deserialization method reads the _ordinal value.

Throws:
IOException

writeObject

private void writeObject(ObjectOutputStream out)
                  throws IOException
Serialization method writes just the ordinal value.

Throws:
IOException