Class CosmosPageRequest

java.lang.Object
org.springframework.data.domain.AbstractPageRequest
org.springframework.data.domain.PageRequest
com.azure.spring.data.cosmos.core.query.CosmosPageRequest
All Implemented Interfaces:
Serializable, org.springframework.data.domain.Pageable

public class CosmosPageRequest extends org.springframework.data.domain.PageRequest
CosmosPageRequest representing page request during pagination query, field FeedResponse.getContinuationToken() response continuation token} is saved to help query next page.

The requestContinuation token should be saved after each request and reused in later queries.

See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    CosmosPageRequest(int page, int size, String requestContinuation)
    Creates a new PageRequest with unsorted parameters applied.
    CosmosPageRequest(int page, int size, String requestContinuation, org.springframework.data.domain.Sort sort)
    Creates a new CosmosPageRequest with sort parameters applied.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    long
     
    To get request continuation
    int
     
    org.springframework.data.domain.PageRequest
     
    of(int page, int size, String requestContinuation, org.springframework.data.domain.Sort sort)
    Creates a new CosmosPageRequest
    of(long offset, int page, int size, String requestContinuation, org.springframework.data.domain.Sort sort)
    Creates a new CosmosPageRequest

    Methods inherited from class org.springframework.data.domain.PageRequest

    first, getSort, of, of, of, ofSize, previous, toString, withPage, withSort, withSort

    Methods inherited from class org.springframework.data.domain.AbstractPageRequest

    getPageNumber, getPageSize, hasPrevious, previousOrFirst

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.springframework.data.domain.Pageable

    getSortOr, isPaged, isUnpaged, toOptional
  • Constructor Details

    • CosmosPageRequest

      public CosmosPageRequest(int page, int size, String requestContinuation)
      Creates a new PageRequest with unsorted parameters applied.
      Parameters:
      page - zero-based page index, must not be negative.
      size - the size of the page to be returned, must be greater than 0.
      requestContinuation - the continuation token of the request.
    • CosmosPageRequest

      public CosmosPageRequest(int page, int size, String requestContinuation, org.springframework.data.domain.Sort sort)
      Creates a new CosmosPageRequest with sort parameters applied.
      Parameters:
      page - zero-based page index, must not be negative.
      size - the size of the page to be returned, must be greater than 0.
      sort - must not be null, use Sort.unsorted() instead.
      requestContinuation - the continuation token of the request.
  • Method Details

    • of

      public static CosmosPageRequest of(int page, int size, String requestContinuation, org.springframework.data.domain.Sort sort)
      Creates a new CosmosPageRequest
      Parameters:
      page - zero-based page index, must not be negative.
      size - the size of the page to be returned, must be greater than 0.
      requestContinuation - cannot be null
      sort - cannot be null
      Returns:
      CosmosPageRequest
    • of

      public static CosmosPageRequest of(long offset, int page, int size, String requestContinuation, org.springframework.data.domain.Sort sort)
      Creates a new CosmosPageRequest
      Parameters:
      offset - cannot be null
      page - zero-based page index, must not be negative.
      size - the size of the page to be returned, must be greater than 0.
      requestContinuation - cannot be null
      sort - cannot be null
      Returns:
      CosmosPageRequest
    • next

      public org.springframework.data.domain.PageRequest next()
      Specified by:
      next in interface org.springframework.data.domain.Pageable
      Overrides:
      next in class org.springframework.data.domain.PageRequest
    • getOffset

      public long getOffset()
      Specified by:
      getOffset in interface org.springframework.data.domain.Pageable
      Overrides:
      getOffset in class org.springframework.data.domain.AbstractPageRequest
    • getRequestContinuation

      public String getRequestContinuation()
      To get request continuation
      Returns:
      String
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class org.springframework.data.domain.PageRequest
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class org.springframework.data.domain.PageRequest