public class RepositoryResult<T> extends AbstractCloseableIteration<T,RepositoryException>
Statement
, Namespace, or Resource objects) that can
be iterated over. It keeps an open connection to the backend for lazy retrieval of individual results.
Additionally it has some utility methods to fetch all results and add them to a collection.
By default, a RepositoryResult is not necessarily a (mathematical) set: it may contain duplicate objects.
Duplicate filtering can be switched on, but this should not be used
lightly as the filtering mechanism is potentially memory-intensive.
A RepositoryResult needs to be closed after use to free up any resources (open
connections, read locks, etc.) it has on the underlying repository.
| Constructor and Description |
|---|
RepositoryResult(CloseableIteration<? extends T,RepositoryException> iter) |
| Modifier and Type | Method and Description |
|---|---|
<C extends Collection<T>> |
addTo(C collection)
Deprecated.
Use
Iterations.addAll(Iteration, Collection) instead. |
List<T> |
asList()
Deprecated.
Use
Iterations.asList(Iteration) instead. |
void |
enableDuplicateFilter()
Switches on duplicate filtering while iterating over objects.
|
protected void |
handleClose() |
boolean |
hasNext() |
T |
next() |
void |
remove() |
close, isClosedpublic RepositoryResult(CloseableIteration<? extends T,RepositoryException> iter)
public boolean hasNext()
throws RepositoryException
RepositoryExceptionpublic T next() throws RepositoryException
RepositoryExceptionpublic void remove()
throws RepositoryException
RepositoryExceptionprotected void handleClose()
throws RepositoryException
handleClose in class AbstractCloseableIteration<T,RepositoryException>RepositoryExceptionpublic void enableDuplicateFilter()
throws RepositoryException
Set and on calling next() or hasNext() will
ignore any objects that already occur in this Set.
Caution: use of this filtering mechanism is potentially memory-intensive.
RepositoryException - if a problem occurred during initialization of the filter.@Deprecated public List<T> asList() throws RepositoryException
Iterations.asList(Iteration) instead.List containing all objects of this RepositoryResult in order of iteration. The
RepositoryResult is fully consumed and automatically closed by this operation.
Note: use this method with caution! It pulls the entire RepositoryResult in memory and as such is potentially very memory-intensive.
RepositoryException - if a problem occurred during retrieval of the results.addTo(Collection)@Deprecated public <C extends Collection<T>> C addTo(C collection) throws RepositoryException
Iterations.addAll(Iteration, Collection) instead.RepositoryException - if a problem occurred during retrieval of the results.Copyright © 2015-2018 Eclipse Foundation. All Rights Reserved.