Class Page<T>

  • Type Parameters:
    T - The modelled type of the object that has been read.

    @ThreadSafe
    public final class Page<T>
    extends Object
    An immutable object that holds a page of queried or scanned results from DynamoDb.

    Contains a reference to the last evaluated key for the current page; see lastEvaluatedKey() for more information.

    • Method Detail

      • create

        @Deprecated
        public static <T> Page<T> create​(List<T> items,
                                         Map<String,​AttributeValue> lastEvaluatedKey)
        Deprecated.
        Static constructor for this object. Deprecated in favor of using the builder() pattern to construct this object.
        Type Parameters:
        T - The modelled type of the object that has been read.
        Parameters:
        items - A list of items to store for the page.
        lastEvaluatedKey - A 'lastEvaluatedKey' to store for the page.
        Returns:
        A newly constructed Page object.
      • create

        @Deprecated
        public static <T> Page<T> create​(List<T> items)
        Deprecated.
        Static constructor for this object that sets a null 'lastEvaluatedKey' which indicates this is the final page of results. Deprecated in favor of using the builder() pattern to construct this object.
        Type Parameters:
        T - The modelled type of the object that has been read.
        Parameters:
        items - A list of items to store for the page.
        Returns:
        A newly constructed Page object.
      • items

        public List<T> items()
        Returns a page of mapped objects that represent records from a database query or scan.
        Returns:
        A list of mapped objects.
      • lastEvaluatedKey

        public Map<String,​AttributeValue> lastEvaluatedKey()
        Returns the 'lastEvaluatedKey' that DynamoDb returned from the last page query or scan. This key can be used to continue the query or scan if passed into a request.
        Returns:
        The 'lastEvaluatedKey' from the last query or scan operation or null if the no more pages are available.
      • count

        public Integer count()
        The count of the returned items from the last page query or scan, after any filters were applied.
      • scannedCount

        public Integer scannedCount()
        The scanned count of the returned items from the last page query or scan, before any filters were applied. This number will be equal or greater than the count.
      • consumedCapacity

        public ConsumedCapacity consumedCapacity()
        Returns the capacity units consumed by the last page query or scan. Will only be returned if it has been explicitly requested by the user when calling the operation.
        Returns:
        The 'consumedCapacity' from the last query or scan operation or null if it was not requested.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object