info.aduna.iteration
Class CloseableIterationBase<E,X extends Exception>

java.lang.Object
  extended by info.aduna.iteration.CloseableIterationBase<E,X>
All Implemented Interfaces:
CloseableIteration<E,X>, Iteration<E,X>
Direct Known Subclasses:
CloseableIteratorIteration, CollectionIteration, ConvertingIteration, DelayedIteration, EmptyIteration, ExceptionConvertingIteration, IterationWrapper, LookAheadIteration, RepositoryResult, SingletonIteration

public abstract class CloseableIterationBase<E,X extends Exception>
extends Object
implements CloseableIteration<E,X>

Base class for CloseableIterations offering common functionality. This class keeps track of whether the iteration has been closed and handles multiple calls to close() by ignoring all but the first call.


Constructor Summary
CloseableIterationBase()
           
 
Method Summary
 void close()
          Calls handleClose() upon first call and makes sure this method gets called only once.
protected  void handleClose()
          Called by close() when it is called for the first time.
 boolean isClosed()
          Checks whether this CloseableIteration has been closed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface info.aduna.iteration.Iteration
hasNext, next, remove
 

Constructor Detail

CloseableIterationBase

public CloseableIterationBase()
Method Detail

isClosed

public final boolean isClosed()
Checks whether this CloseableIteration has been closed.

Returns:
true if the CloseableIteration has been closed, false otherwise.

close

public final void close()
                 throws X extends Exception
Calls handleClose() upon first call and makes sure this method gets called only once.

Specified by:
close in interface CloseableIteration<E,X extends Exception>
Throws:
X extends Exception

handleClose

protected void handleClose()
                    throws X extends Exception
Called by close() when it is called for the first time. This method is only called once on each iteration. By default, this method does nothing.

Throws:
X
X extends Exception


Copyright © 2001-2012 Aduna. All Rights Reserved.