- Type Parameters:
T
- query result type (entity or entity attribute)
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 Summary
Modifier and TypeMethodDescriptionstatic <T> Page
<T> create
(PageRequest request, List<T> content, int totalSize) Create pageable query result as page with total size of the result.int
Total number of pages.int
Total size of the result across all pages.Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
Method Details
-
create
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 requestcontent
- page content asList
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
-