java.lang.Object
org.springframework.data.domain.AbstractPageRequest
org.springframework.data.domain.PageRequest
com.google.cloud.spring.data.datastore.repository.query.DatastorePageable
All Implemented Interfaces:
Serializable, org.springframework.data.domain.Pageable

public class DatastorePageable extends org.springframework.data.domain.PageRequest
A pageable implementation for Cloud Datastore that uses the cursor for efficient reads.

The static methods can take either paged or unpaged Pageable, while instance methods only deal with a paged self object.

See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.springframework.data.domain.Pageable
    from(org.springframework.data.domain.Pageable pageable, com.google.cloud.datastore.Cursor cursor, Long totalCount)
    Creates a DatastorePageable wrapper for a paged request, but passes unpaged requests back unchanged.
    static org.springframework.data.domain.Pageable
    from(org.springframework.data.domain.Pageable pageable, String urlSafeCursor, Long totalCount)
    Creates a DatastorePageable wrapper for a paged request, but passes unpaged requests back unchanged.
     
     
    org.springframework.data.domain.PageRequest
     
    com.google.cloud.datastore.Cursor
     

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

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

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

    getOffset, 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, toLimit, toOptional, toScrollPosition
  • Method Details

    • from

      public static org.springframework.data.domain.Pageable from(org.springframework.data.domain.Pageable pageable, com.google.cloud.datastore.Cursor cursor, Long totalCount)
      Creates a DatastorePageable wrapper for a paged request, but passes unpaged requests back unchanged.
      Parameters:
      pageable - The source Pageable that can be paged or unpaged
      cursor - Current cursor; null if not applicable
      totalCount - Total result count
      Returns:
      an instance of DatastorePageable or the original unpaged Pageable.
    • from

      public static org.springframework.data.domain.Pageable from(org.springframework.data.domain.Pageable pageable, String urlSafeCursor, Long totalCount)
      Creates a DatastorePageable wrapper for a paged request, but passes unpaged requests back unchanged.
      Parameters:
      pageable - The source Pageable that can be paged or unpaged
      urlSafeCursor - Current cursor as ; null if not applicable
      totalCount - Current cursor; null if not applicable
      Returns:
      an instance of DatastorePageable or the original unpaged Pageable.
    • getUrlSafeCursor

      public String getUrlSafeCursor()
    • 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
    • toCursor

      public com.google.cloud.datastore.Cursor toCursor()
    • getTotalCount

      public Long getTotalCount()