Package org.springframework.data.support
Class PageableExecutionUtils
java.lang.Object
org.springframework.data.support.PageableExecutionUtils
Support for query execution using
Pageable
. Using PageableExecutionUtils
assumes that data queries
are cheaper than COUNT
queries and so some cases can take advantage of optimizations.- Since:
- 2.4
- Author:
- Mark Paluch, Oliver Gierke, Christoph Strobl, Jens Schauder, Jay Lee
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Page<T>
getPage
(List<T> content, Pageable pageable, LongSupplier totalSupplier)
-
Method Details
-
getPage
Constructs aPage
based on the givencontent
,Pageable
andLongSupplier
applying optimizations. The construction ofPage
omits a count query if the total can be determined based on the result size andPageable
.- Parameters:
content
- result of a query with appliedPageable
. The list must not be null and must contain up toPageable.getPageSize()
items.pageable
- must not be null.totalSupplier
- must not be null.- Returns:
- the
Page
forcontent
and a total size.
-