Class PagedResult<T>
java.lang.Object
dev.hogwai.dynamodb.simplified.result.PagedResult<T>
- Type Parameters:
T- the type of items in the result page
- All Implemented Interfaces:
Consumed
Holds a single page of results from a DynamoDB
Query or Scan
operation as part of the DynamoDB Simplified library.
Contains the list of items returned for the current page and the
lastEvaluatedKey that can be passed to a subsequent request to
retrieve the next page of results. If lastEvaluatedKey is
null or empty, there are no more pages to fetch.
-
Constructor Summary
ConstructorsConstructorDescriptionPagedResult(@NonNull List<T> items, @Nullable Map<String, software.amazon.awssdk.services.dynamodb.model.AttributeValue> lastEvaluatedKey) Constructs a newPagedResultwith no consumed capacity information.PagedResult(@NonNull List<T> items, @Nullable Map<String, software.amazon.awssdk.services.dynamodb.model.AttributeValue> lastEvaluatedKey, @Nullable software.amazon.awssdk.services.dynamodb.model.ConsumedCapacity consumedCapacity) Constructs a newPagedResult. -
Method Summary
Modifier and TypeMethodDescription@Nullable software.amazon.awssdk.services.dynamodb.model.ConsumedCapacityReturns the consumed capacity, ornullif capacity was not requested or the operation does not support capacity tracking.booleanReturns whether there are more pages of results available.booleanisEmpty()Returns whether this page contains zero items.items()Returns the list of items in this page.Returns the last-evaluated key that can be used as theexclusiveStartKeyin a subsequent request to fetch the next page.intsize()Returns the number of items in this page.
-
Constructor Details
-
PagedResult
public PagedResult(@NonNull List<T> items, @Nullable Map<String, software.amazon.awssdk.services.dynamodb.model.AttributeValue> lastEvaluatedKey) Constructs a newPagedResultwith no consumed capacity information.- Parameters:
items- the items in this pagelastEvaluatedKey- the last-evaluated key for pagination, ornull
-
PagedResult
public PagedResult(@NonNull List<T> items, @Nullable Map<String, software.amazon.awssdk.services.dynamodb.model.AttributeValue> lastEvaluatedKey, @Nullable software.amazon.awssdk.services.dynamodb.model.ConsumedCapacity consumedCapacity) Constructs a newPagedResult.- Parameters:
items- the items in this pagelastEvaluatedKey- the last-evaluated key for pagination, ornullconsumedCapacity- the consumed capacity, ornull
-
-
Method Details
-
consumedCapacity
public @Nullable software.amazon.awssdk.services.dynamodb.model.ConsumedCapacity consumedCapacity()Returns the consumed capacity, ornullif capacity was not requested or the operation does not support capacity tracking.- Specified by:
consumedCapacityin interfaceConsumed- Returns:
- consumed capacity, or
null
-
items
-
lastEvaluatedKey
public @Nullable Map<String, software.amazon.awssdk.services.dynamodb.model.AttributeValue> lastEvaluatedKey()Returns the last-evaluated key that can be used as theexclusiveStartKeyin a subsequent request to fetch the next page. A return value ofnullor an empty map indicates no more pages.- Returns:
- the last-evaluated key, or
null/ empty if this is the last page
-
hasMorePages
public boolean hasMorePages()Returns whether there are more pages of results available.- Returns:
trueif a subsequent request will yield more items,falseotherwise
-
size
public int size()Returns the number of items in this page.- Returns:
- the item count
-
isEmpty
public boolean isEmpty()Returns whether this page contains zero items.- Returns:
trueif the page has no items,falseotherwise
-