public abstract class ExceptionConvertingIteration<E,X extends Exception> extends CloseableIterationBase<E,X>
convert(Exception)
to do the conversion.Constructor and Description |
---|
ExceptionConvertingIteration(Iteration<? extends E,? extends Exception> iter)
Creates a new ExceptionConvertingIteration that operates on the supplied
iteration.
|
Modifier and Type | Method and Description |
---|---|
protected abstract X |
convert(Exception e)
Converts an exception from the underlying iteration to an exception of
type X.
|
protected void |
handleClose()
Closes this Iteration as well as the wrapped Iteration if it happens to be
a
CloseableIteration . |
boolean |
hasNext()
Checks whether the underlying Iteration contains more elements.
|
E |
next()
Returns the next element from the wrapped Iteration.
|
void |
remove()
Calls remove() on the underlying Iteration.
|
close, isClosed
public ExceptionConvertingIteration(Iteration<? extends E,? extends Exception> iter)
iter
- The Iteration that this ExceptionConvertingIteration
operates on, must not be null.protected abstract X convert(Exception e)
public boolean hasNext() throws X extends Exception
public E next() throws X extends Exception
X
NoSuchElementException
- If all elements have been returned.IllegalStateException
- If the Iteration has been closed.X extends Exception
public void remove() throws X extends Exception
UnsupportedOperationException
- If the wrapped Iteration does not support the remove
operation.IllegalStateException
- If the Iteration has been closed, or if next()
has not yet
been called, or remove()
has already been called after the
last call to next()
.X extends Exception
protected void handleClose() throws X extends Exception
CloseableIteration
.handleClose
in class CloseableIterationBase<E,X extends Exception>
X
X extends Exception
Copyright © 2001-2016 Aduna. All Rights Reserved.