Package net.sf.basedb.core
Class ItemResultIterator<I extends BasicItem>
- java.lang.Object
-
- net.sf.basedb.core.ItemResultIterator<I>
-
- All Implemented Interfaces:
AutoCloseable
,Iterator<I>
,QueryResult
,ResultIterator<I>
public class ItemResultIterator<I extends BasicItem> extends Object implements ResultIterator<I>
Return the results of anItemQuery
as an iterator.- Version:
- 2.0
- Author:
- Samuel, Nicklas
- See Also:
ItemQuery.iterate(DbControl)
- Last modified
- $Date: 2012-09-14 09:28:35 +0200 (fr, 14 sep 2012) $
-
-
Field Summary
Fields Modifier and Type Field Description private ScrollIterator<? extends BasicData>
data
The internal iterator of BasicData objects.private DbControl
dc
The DbControl tthat was used in the query.private Class<I>
itemClass
The class of the items returned by the query (and this object).private Item
itemType
The type of items returned by the query.private long
totalCount
The total number of items.
-
Constructor Summary
Constructors Constructor Description ItemResultIterator(ScrollIterator<? extends BasicData> data, DbControl dc, Class<I> itemClass, long totalCount)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
From the ResultIterator interface ---------------------------------Item
getItemType()
Get the type of items contained in this list.long
getTotalCount()
From the QueryResult interface ---------------------------------boolean
hasNext()
boolean
isClosed()
Check if the iterator has been closed.I
next()
void
remove()
Not supported.-
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 Detail
-
data
private final ScrollIterator<? extends BasicData> data
The internal iterator of BasicData objects.
-
dc
private final DbControl dc
The DbControl tthat was used in the query.
-
itemClass
private final Class<I extends BasicItem> itemClass
The class of the items returned by the query (and this object).
-
totalCount
private final long totalCount
The total number of items.
-
itemType
private final Item itemType
The type of items returned by the query.
-
-
Constructor Detail
-
ItemResultIterator
ItemResultIterator(ScrollIterator<? extends BasicData> data, DbControl dc, Class<I> itemClass, long totalCount)
-
-
Method Detail
-
getTotalCount
public long getTotalCount()
From the QueryResult interface ---------------------------------- Specified by:
getTotalCount
in interfaceQueryResult
- Returns:
- The total number of items, or -1 if not known
- See Also:
Query.setReturnTotalCount(boolean)
-
close
public void close()
From the ResultIterator interface ---------------------------------- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceResultIterator<I extends BasicItem>
-
isClosed
public boolean isClosed()
Description copied from interface:ResultIterator
Check if the iterator has been closed.- Specified by:
isClosed
in interfaceResultIterator<I extends BasicItem>
-
remove
public void remove()
Not supported.- Specified by:
remove
in interfaceIterator<I extends BasicItem>
- Throws:
UnsupportedOperationException
- Always
-
-