Class PageImpl<T>

java.lang.Object
com.google.cloud.PageImpl<T>
Type Parameters:
T - the value type that the page holds
All Implemented Interfaces:
Page<T>, Serializable
Direct Known Subclasses:
AsyncPageImpl

@InternalApi public class PageImpl<T> extends Object implements Page<T>, Serializable
Base implementation for Google Cloud paginated results.
See Also:
  • Constructor Details

    • PageImpl

      public PageImpl(PageImpl.NextPageFetcher<T> pageFetcher, String cursor, Iterable<T> results)
      Creates a PageImpl object. In order for the object to be serializable the results parameter must be serializable.
  • Method Details

    • getValues

      public Iterable<T> getValues()
      Specified by:
      getValues in interface Page<T>
    • iterateAll

      public Iterable<T> iterateAll()
      Specified by:
      iterateAll in interface Page<T>
    • hasNextPage

      public boolean hasNextPage()
      Specified by:
      hasNextPage in interface Page<T>
    • getNextPageToken

      public String getNextPageToken()
      Specified by:
      getNextPageToken in interface Page<T>
    • getNextPage

      public Page<T> getNextPage()
      Specified by:
      getNextPage in interface Page<T>
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • nextRequestOptions

      public static <T> Map<T,Object> nextRequestOptions(T pageTokenOption, String cursor, Map<T,?> optionMap)
      Utility method to construct the options map for the next page request.
      Type Parameters:
      T - the value type that the page holds. Instances of T should be Serializable
      Parameters:
      pageTokenOption - the key for the next page cursor option in the options map
      cursor - the cursor for the next page
      optionMap - the previous options map
      Returns:
      the options map for the next page request