public interface Cursor<T extends Pojo> extends Iterator<T>
Storage
.PreparedStatement.executeQuery()
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_BATCH_SIZE |
Modifier and Type | Method and Description |
---|---|
int |
getBatchSize() |
boolean |
hasNext() |
T |
next()
Retrieves the next element from the result set.
|
void |
setBatchSize(int n)
Sets the configured batch size when retrieving more elements from the
database.
|
forEachRemaining, remove
static final int DEFAULT_BATCH_SIZE
void setBatchSize(int n) throws IllegalArgumentException
Sets the configured batch size when retrieving more elements from the database. That is, no more elements will be loaded into memory than the configured batch size. Note that the new batch size will only take effect once the current batch is exhausted.
The default batch size is 100.
n
- The number of results to fetch from storage in a single batch.IllegalArgumentException
- If n
is < 1int getBatchSize()
setBatchSize
or
BatchCursor#DEFAULT_BATCH_SIZE
if it was never set
explicitly.boolean hasNext()
T next()
hasNext()
prior to calling this method.next
in interface Iterator<T extends Pojo>
The next element of the result set. null
if there is no
next element.
Please note: This will change with the next
release. In the next major release a
NoSuchElementException
will be thrown if there is no next
element. I.e. hasNext()
returns false
, but
next()
is still being called.
StorageException
- If there was a problem with underlying Storage
.Copyright © 2017. All rights reserved.