Interface Page<T>

Type Parameters:
T - query result type (entity or entity attribute)
All Superinterfaces:
Iterable<T>, Slice<T>

public interface Page<T> extends Slice<T>
Pageable query result as pages with total size of the result.

Page number and number of records returned on each page depends on values of the Slice.request() used to return current page.

Returned value of totalSize() and totalPages() requires another query to be executed while reading data from the database, so retrieving result as Slice should be faster than using Page.

  • Method Details

    • create

      static <T> Page<T> create(PageRequest request, List<T> content, int totalSize)
      Create pageable query result as page with total size of the result.
      Type Parameters:
      T - query result type (entity or entity attribute)
      Parameters:
      request - pageable query result request
      content - page content as List
      totalSize - total size of the result across all pages
      Returns:
      new instance of the query result
    • totalSize

      int totalSize()
      Total size of the result across all pages.
      Returns:
      total size of the result
    • totalPages

      int totalPages()
      Total number of pages.
      Returns:
      total number of pages