Package net.sf.basedb.util.query
Class MultiQueryIterator<E extends BasicItem>
java.lang.Object
net.sf.basedb.util.query.MultiQueryIterator<E>
- All Implemented Interfaces:
Iterator<E>
Helper class for executing multiple queries and return the result as
a single iterator. The queries are executed in the order that they
are given, if a query doesn't return any result, the iterator continues
with the next query. As soon as a query returns at least one
result, no more queries are executed.
- Since:
- 3.2
- Author:
- nicklas
-
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionprivate
MultiQueryIterator
(DbControl dc, ItemQuery<? extends E>[] queries) -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Iterator
forEachRemaining
-
Field Details
-
dc
-
queries
-
current
-
nextQuery
private int nextQuery -
numReturned
private int numReturned
-
-
Constructor Details
-
MultiQueryIterator
-
-
Method Details
-
get
@SafeVarargs public static <E extends BasicItem> Iterator<E> get(DbControl dc, ItemQuery<? extends E>... queries) Create a new iterator for the given list of queries. There must be at least one query.- Parameters:
dc
- The DbControl to use when executing the queriesqueries
- An array of queries to execute
-
hasNext
public boolean hasNext() -
next
-
remove
public void remove()
-