org.openrdf.repository.object.result
Class ObjectIterator<S,E>

java.lang.Object
  extended by org.openrdf.repository.object.result.ObjectIterator<S,E>
Type Parameters:
S - Type of the delegate (Statement)
E - Type of the result
All Implemented Interfaces:
Iterator<E>

public abstract class ObjectIterator<S,E>
extends Object
implements Iterator<E>

A general purpose iteration wrapping Sesame's iterations. This class converts the results, converts the Exceptions into RDFObjectRuntimeExeptions, and ensures that the iteration is closed when all values have been read (on { next()).

Author:
James Leigh

Constructor Summary
ObjectIterator(CloseableIteration<? extends S,?> delegate)
           
 
Method Summary
<C extends Collection<? super E>>
C
addTo(C collection)
           
 List<E> asList()
           
 Set<E> asSet()
           
 void close()
           
static void close(Iterator<?> iter)
           
protected  E convert(S element)
           
 boolean hasNext()
           
 E next()
           
 void remove()
           
protected  void remove(S element)
           
 E singleResult()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectIterator

public ObjectIterator(CloseableIteration<? extends S,?> delegate)
Method Detail

close

public static void close(Iterator<?> iter)

hasNext

public boolean hasNext()
Specified by:
hasNext in interface Iterator<E>

next

public E next()
Specified by:
next in interface Iterator<E>

remove

public void remove()
Specified by:
remove in interface Iterator<E>

close

public void close()

singleResult

public E singleResult()
               throws RepositoryException
Throws:
RepositoryException

asList

public List<E> asList()
               throws RepositoryException
Throws:
RepositoryException

asSet

public Set<E> asSet()
             throws RepositoryException
Throws:
RepositoryException

addTo

public <C extends Collection<? super E>> C addTo(C collection)
                                      throws RepositoryException
Throws:
RepositoryException

convert

protected E convert(S element)
             throws RepositoryException
Throws:
RepositoryException

remove

protected void remove(S element)
               throws RepositoryException
Throws:
RepositoryException


Copyright © 2004-2010 James Leigh Services Inc.. All Rights Reserved.