SerializableEnumeration Class

DEPRECATED

com.beasys.commerce.util
SerializableEnumeration Class

public class SerializableEnumeration

    extends Object
    implements Enumeration, Serializable

An implementation of the Enumeration interface which is Serializable.

Note: Since most Enumeration implementations aren't Serializable (including Vector.elements() and Collections.enumeration()), we need this to return Enumerations from SessionBeans and other RemoteObjects. Most collection classes are Serializable, so that's nice. However, to make life easier, this uses the underlying Collection's iterator, most of which also aren't Serializable. Therefore, if a partial enumeration has been done before this Enumeration is serialized, the enumeration will start over on the other side because this internally keeps the Collection's Iterator in a transient field (since Iterator aren't generally Serializable).

This is also intentionally not thread-safe.


Hierarchy
Object
  SerializableEnumeration
All Implemented Interfaces

Enumeration, Serializable

Field Summary

protected Collection
c
The Collection we're fronting for.
protected transient Iterator
i
The current iterator.
 

Constructor Summary

SerializableEnumeration(Collection c)

Constructor.
 

Method Summary

public boolean
hasMoreElements()
Tell if this enumeration has more elements.
public Object
nextElement()
Get the next element in the enumeration.
 
Methods from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
   
Methods from interface java.util.Enumeration
hasMoreElements, nextElement
 

Field Detail

c

protected Collection c
The Collection we're fronting for.


i

protected transient Iterator i
The current iterator.

 

Constructor Detail

SerializableEnumeration

public SerializableEnumeration(Collection c)
Constructor.
 

Method Detail

hasMoreElements() Method

public boolean hasMoreElements()
Tell if this enumeration has more elements.


nextElement() Method

public Object nextElement()
Get the next element in the enumeration.