Expresso 5-6

com.jcorporate.expresso.kernel.util
Class DataContextIterator

java.lang.Object
  extended bycom.jcorporate.expresso.kernel.util.DataContextIterator
All Implemented Interfaces:
Iterator

public class DataContextIterator
extends Object
implements Iterator

This class is useful for iterating through all data contexts that are installed at the root level of the Expresso Runtime hierarchy. Use it like a normal iterator except that it is explictly constructed.

Example Usage:
  for (DataContextIterator it = new DataContextIterator(); it.hasNext();) {
     DataContext oneContext = (DataContext)it.next();
     System.out.println("Context Name: " + oneContext.getMetaData().getName());
  }

Since:
Expresso 5.1
Version:
$Revision: 1.6 $ on $Date: 2004/11/17 20:48:17 $
Author:
Michael Rimov

Constructor Summary
DataContextIterator()
          Default constructor.
DataContextIterator(RootContainerInterface iteratingRuntime)
          Constructor that uses the RootContainerInterface given to it.
DataContextIterator(String runtimeName)
          Constructor that finds a runtime by name.
 
Method Summary
 boolean hasNext()
          Checks if another object exists.
 Object next()
          Retrieve the Next Data Context in the sequence.
 DataContext nextContext()
          Retrieve the Next Data Context in the sequence.
 void remove()
          Not implemented.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataContextIterator

public DataContextIterator()
Default constructor. Searches for and gets the default runtime map.

Throws:
IllegalArgumentException - if the iterator is unable to find the runtime.

DataContextIterator

public DataContextIterator(String runtimeName)
Constructor that finds a runtime by name.

Parameters:
runtimeName - The name of the runtime the user wants to iterate
Throws:
IllegalArgumentException - if the iterator is unable to find the runtime.

DataContextIterator

public DataContextIterator(RootContainerInterface iteratingRuntime)
Constructor that uses the RootContainerInterface given to it.

Parameters:
iteratingRuntime - the RootContainerInterface to iterate.
Method Detail

hasNext

public boolean hasNext()
Checks if another object exists.

Specified by:
hasNext in interface Iterator
Returns:
true if there is another data context to iterate.
See Also:
Iterator.hasNext()

next

public Object next()
Retrieve the Next Data Context in the sequence.

Specified by:
next in interface Iterator
Returns:
an Object that is of type com.jcorporate.expresso.kernel.DataContext
Throws:
ArrayIndexOutOfBoundsException - if we iterate past the end.

nextContext

public DataContext nextContext()
Retrieve the Next Data Context in the sequence. The only difference between this and next() is that this function doesn't require a downcast.

Returns:
an Object that is of type com.jcorporate.expresso.kernel.DataContext
Throws:
ArrayIndexOutOfBoundsException - if we iterate past the end.

remove

public void remove()
Not implemented. Way too dangerous of a capability

Specified by:
remove in interface Iterator

Expresso 5-6

Please see www.jcorporate.com for information about new Expresso releases.