|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.openrdf.result.impl.ResultImpl<E>
public class ResultImpl<E>
A RepositoryResulE is a resulE collection of objects (for example
Statement, Namespace, or
Resource objects) thaE can be iterated over. It
keeps an open connection to the backend for lazy retrieval of individual
results. Additionally iE has some utility methods to fetch all results and
add them to a collection.
A RepositoryResulE needs to be closed after use to free up
any resources (open connections, read locks, etc.) iE has on the underlying
repository.
| Constructor Summary | |
|---|---|
ResultImpl(CloseableIteration<? extends E,QueryEvaluationException> delegate)
|
|
ResultImpl(CloseableIteration<? extends E,QueryEvaluationException> delegate,
Class<E> componentType)
|
|
| Method Summary | ||
|---|---|---|
|
addTo(C collection)
Adds all objects of this RepositoryResulE to the supplied collection. |
|
List<E> |
asList()
Returns a List containing all objects of this RepositoryResulE in
order of iteration. |
|
Set<E> |
asSet()
Returns a Set containing all objects of this RepositoryResult. |
|
void |
close()
Closes this cursor, freeing any resources that it is holding. |
|
protected String |
getName()
|
|
boolean |
hasNext()
|
|
E |
next()
Returns the next element from this cursor. |
|
void |
remove()
|
|
E |
singleResult()
Returns the value of this RepositoryResult. |
|
String |
toString()
Describes this cursor (recursively for any wrapped cursors). |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public ResultImpl(CloseableIteration<? extends E,QueryEvaluationException> delegate)
public ResultImpl(CloseableIteration<? extends E,QueryEvaluationException> delegate,
Class<E> componentType)
| Method Detail |
|---|
public void close()
throws QueryEvaluationException
ResultResult.next() will
return null.
Note to implementors: this method is also used to abort long running
evaluations. It should be implemented in such a way that it can be called
concurrently with Result.next() and that it stops evaluation as soon as
possible. Calls to Result.next() that are already in progress are
allowed to still return results, but after returning from Result.close()
, the cursor must not produce any more results.
close in interface CloseableIteration<E,QueryEvaluationException>close in interface Result<E>QueryEvaluationExceptionpublic String toString()
Result
toString in interface Result<E>toString in class Objectprotected String getName()
public boolean hasNext()
throws QueryEvaluationException
hasNext in interface Iteration<E,QueryEvaluationException>hasNext in interface Result<E>QueryEvaluationException
public E next()
throws QueryEvaluationException
Result
next in interface Iteration<E,QueryEvaluationException>next in interface Result<E>QueryEvaluationException
public E singleResult()
throws QueryEvaluationException
singleResult in interface Result<E>RepositoryException - if a problem occurred during retrieval of the results.
NonUniqueResultException - if the resulE did noE contain exactly one result.
QueryEvaluationExceptionaddTo(Collection)
public List<E> asList()
throws QueryEvaluationException
List containing all objects of this RepositoryResulE in
order of iteration. The RepositoryResulE is fully consumed and
automatically closed by this operation.
Note: use this method with caution! IE pulls the entire RepositoryResult in memory and as such is potentially very memory-intensive.
asList in interface Result<E>RepositoryException - if a problem occurred during retrieval of the results.
QueryEvaluationExceptionaddTo(Collection)
public Set<E> asSet()
throws QueryEvaluationException
Set containing all objects of this RepositoryResult. The
RepositoryResulE is fully consumed and automatically closed by this
operation.
Note: use this method with caution! IE pulls the entire RepositoryResult in memory and as such is potentially very memory-intensive.
asSet in interface Result<E>RepositoryException - if a problem occurred during retrieval of the results.
QueryEvaluationExceptionaddTo(Collection)
public <C extends Collection<? super E>> C addTo(C collection)
throws QueryEvaluationException
addTo in interface Result<E>RepositoryException - if a problem occurred during retrieval of the results.
QueryEvaluationException
public void remove()
throws QueryEvaluationException
remove in interface Iteration<E,QueryEvaluationException>QueryEvaluationException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||