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

public final class PagedResult<T> extends Object implements 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

    Constructors
    Constructor
    Description
    PagedResult(@NonNull List<T> items, @Nullable Map<String, software.amazon.awssdk.services.dynamodb.model.AttributeValue> lastEvaluatedKey)
    Constructs a new PagedResult with 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 new PagedResult.
  • Method Summary

    Modifier and Type
    Method
    Description
    @Nullable software.amazon.awssdk.services.dynamodb.model.ConsumedCapacity
    Returns the consumed capacity, or null if capacity was not requested or the operation does not support capacity tracking.
    boolean
    Returns whether there are more pages of results available.
    boolean
    Returns whether this page contains zero items.
    @NonNull List<T>
    Returns the list of items in this page.
    @Nullable Map<String, software.amazon.awssdk.services.dynamodb.model.AttributeValue>
    Returns the last-evaluated key that can be used as the exclusiveStartKey in a subsequent request to fetch the next page.
    int
    Returns the number of items in this page.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • PagedResult

      public PagedResult(@NonNull List<T> items, @Nullable Map<String, software.amazon.awssdk.services.dynamodb.model.AttributeValue> lastEvaluatedKey)
      Constructs a new PagedResult with no consumed capacity information.
      Parameters:
      items - the items in this page
      lastEvaluatedKey - the last-evaluated key for pagination, or null
    • 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 new PagedResult.
      Parameters:
      items - the items in this page
      lastEvaluatedKey - the last-evaluated key for pagination, or null
      consumedCapacity - the consumed capacity, or null
  • Method Details

    • consumedCapacity

      public @Nullable software.amazon.awssdk.services.dynamodb.model.ConsumedCapacity consumedCapacity()
      Returns the consumed capacity, or null if capacity was not requested or the operation does not support capacity tracking.
      Specified by:
      consumedCapacity in interface Consumed
      Returns:
      consumed capacity, or null
    • items

      public @NonNull List<T> items()
      Returns the list of items in this page.
      Returns:
      the items (never null)
    • lastEvaluatedKey

      public @Nullable Map<String, software.amazon.awssdk.services.dynamodb.model.AttributeValue> lastEvaluatedKey()
      Returns the last-evaluated key that can be used as the exclusiveStartKey in a subsequent request to fetch the next page. A return value of null or 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:
      true if a subsequent request will yield more items, false otherwise
    • 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:
      true if the page has no items, false otherwise