R
- low level result typepublic abstract class ItemCollection<R> extends com.amazonaws.services.dynamodbv2.document.internal.PageBasedCollection<Item,R>
Item
's.
An ItemCollection
object maintains a cursor pointing to its
current pages of data. Initially the cursor is positioned before the first page.
The next method moves the cursor to the next row, and because it returns
false when there are no more rows in the ItemCollection
object,
it can be used in a while loop to iterate through the collection.
Network calls can be triggered when the collection is iterated across page
boundaries.Constructor and Description |
---|
ItemCollection() |
Modifier and Type | Method and Description |
---|---|
protected void |
accumulateStats(ConsumedCapacity consumedCapacity,
Integer count,
Integer scannedCount) |
R |
getLastLowLevelResult()
Returns the low-level result last retrieved (for the current page) from
the server side; or null if there has yet no calls to the server.
|
abstract Integer |
getMaxResultSize()
Returns the maximum number of resources to be retrieved in this
collection; or null if there is no limit.
|
ConsumedCapacity |
getTotalConsumedCapacity()
Returns the total consumed capacity accumulated so far.
|
int |
getTotalCount()
Returns the total count accumulated so far.
|
int |
getTotalScannedCount()
Returns the total scanned count accumulated so far.
|
com.amazonaws.services.dynamodbv2.document.internal.PageIterable<Item,R> |
pages()
Returns an
Iterable<Page<Item, R>> that iterates over pages of
items from this collection. |
LowLevelResultListener<R> |
registerLowLevelResultListener(LowLevelResultListener<R> listener)
Used to register a listener for the event of receiving a low-level result
from the server side.
|
firstPage, iterator, setLastLowLevelResult
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
protected final void accumulateStats(ConsumedCapacity consumedCapacity, Integer count, Integer scannedCount)
public int getTotalCount()
public int getTotalScannedCount()
public ConsumedCapacity getTotalConsumedCapacity()
public com.amazonaws.services.dynamodbv2.document.internal.PageIterable<Item,R> pages()
Iterable<Page<Item, R>>
that iterates over pages of
items from this collection. Each call to Iterator.next
on an
Iterator
returned from this Iterable
results in exactly
one call to DynamoDB to retrieve a single page of results.
ItemCollection<QueryResult> collection = ...;
for (Page<Item> page : collection.pages()) {
processItems(page);
ConsumedCapacity consumedCapacity =
page.getLowLevelResult().getConsumedCapacity();
Thread.sleep(getBackoff(consumedCapacity.getCapacityUnits()));
}
The use of the internal/undocumented PageIterable
class instead
of Iterable
in the public interface here is retained for
backwards compatibility. It doesn't expose any methods beyond those
of the Iterable
interface. This method will be changed to return
an Iterable<Page<Item, R>>
directly in a future release of the
SDK.
pages
in class com.amazonaws.services.dynamodbv2.document.internal.PageBasedCollection<Item,R>
Page
public abstract Integer getMaxResultSize()
getMaxResultSize
in class com.amazonaws.services.dynamodbv2.document.internal.PageBasedCollection<Item,R>
public R getLastLowLevelResult()
public LowLevelResultListener<R> registerLowLevelResultListener(LowLevelResultListener<R> listener)
registerLowLevelResultListener
in class com.amazonaws.services.dynamodbv2.document.internal.PageBasedCollection<Item,R>
listener
- listener to be registered. If null, a "none" listener will be
set.Copyright © 2016. All rights reserved.