Class ItemCollection<R>
- java.lang.Object
-
- com.amazonaws.services.dynamodbv2.document.internal.PageBasedCollection<Item,R>
-
- com.amazonaws.services.dynamodbv2.document.ItemCollection<R>
-
- Type Parameters:
R- low level result type
public abstract class ItemCollection<R> extends com.amazonaws.services.dynamodbv2.document.internal.PageBasedCollection<Item,R>
A collection ofItem's. AnItemCollectionobject 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 theItemCollectionobject, 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 Summary
Constructors Constructor Description ItemCollection()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected voidaccumulateStats(ConsumedCapacity consumedCapacity, Integer count, Integer scannedCount)ConsumedCapacitygetAccumulatedConsumedCapacity()Returns the consumed capacity accumulated so far.intgetAccumulatedItemCount()Returns the count of items accumulated so far.intgetAccumulatedScannedCount()Returns the scanned count accumulated so far.RgetLastLowLevelResult()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 IntegergetMaxResultSize()Returns the maximum number of resources to be retrieved in this collection; or null if there is no limit.ConsumedCapacitygetTotalConsumedCapacity()Deprecated.This method returns the accumulated consumed capacity and not the total.intgetTotalCount()Deprecated.This method returns the accumulated count and not the total count.intgetTotalScannedCount()Deprecated.This method returns the accumulated count and not the total count.com.amazonaws.services.dynamodbv2.document.internal.PageIterable<Item,R>pages()Returns anIterable<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.-
Methods inherited from class com.amazonaws.services.dynamodbv2.document.internal.PageBasedCollection
firstPage, iterator, setLastLowLevelResult
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Method Detail
-
accumulateStats
protected final void accumulateStats(ConsumedCapacity consumedCapacity, Integer count, Integer scannedCount)
-
getTotalCount
@Deprecated public int getTotalCount()
Deprecated.This method returns the accumulated count and not the total count. UsegetAccumulatedItemCount()instead.Returns the count of items accumulated so far.
-
getAccumulatedItemCount
public int getAccumulatedItemCount()
Returns the count of items accumulated so far.
-
getTotalScannedCount
@Deprecated public int getTotalScannedCount()
Deprecated.This method returns the accumulated count and not the total count. UsegetAccumulatedScannedCount()instead.Returns the scanned count accumulated so far.
-
getAccumulatedScannedCount
public int getAccumulatedScannedCount()
Returns the scanned count accumulated so far.
-
getTotalConsumedCapacity
@Deprecated public ConsumedCapacity getTotalConsumedCapacity()
Deprecated.This method returns the accumulated consumed capacity and not the total. UsegetAccumulatedScannedCount()instead.Returns the consumed capacity accumulated so far.
-
getAccumulatedConsumedCapacity
public ConsumedCapacity getAccumulatedConsumedCapacity()
Returns the consumed capacity accumulated so far.
-
pages
public com.amazonaws.services.dynamodbv2.document.internal.PageIterable<Item,R> pages()
Returns anIterable<Page<Item, R>>that iterates over pages of items from this collection. Each call toIterator.nexton anIteratorreturned from thisIterableresults 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
PageIterableclass instead ofIterablein the public interface here is retained for backwards compatibility. It doesn't expose any methods beyond those of theIterableinterface. This method will be changed to return anIterable<Page<Item, R>>directly in a future release of the SDK.
-
getMaxResultSize
public abstract Integer getMaxResultSize()
Returns the maximum number of resources to be retrieved in this collection; or null if there is no limit.
-
getLastLowLevelResult
public 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.
-
registerLowLevelResultListener
public LowLevelResultListener<R> registerLowLevelResultListener(LowLevelResultListener<R> listener)
Used to register a listener for the event of receiving a low-level result from the server side.
-
-