Interface NarrowedPageable
- All Superinterfaces:
org.springframework.data.domain.Pageable
,UnnumberedPageable
- All Known Implementing Classes:
DefaultNarrowedPageable
Pageable
that is suitable for denoting page boundaries for a narrowed fetch. Narrowed
fetch results generally go through a NarrowExecutor
, and as a result, can provide a
narrowed result set from what is physically represented in the database. For this reason, it is
important to keep track of a silent getUnderlyingPageSize()
when determining next page
offset values. For example, next page offset is generally calculated as the current offset plus
the underlyingPageSize.
An example API request containing a Pageable param could start off with these params for the first page:
- forward : true
- offset : 0
- size : 2
- underlyingSize : 3
- numberOfElements : 2
- first : true
- forward : true
- offset : 3
- size : 2
A backward NarrowedPageable request should always pivot off the current offset. This means that to go backward for the current page, you would keep the current offset, but reverse the direction:
- forward : false
- offset : 3
- size : 2
- underlyingSize : 3
- numberOfElements : 2
- first : true
- Author:
- Jeff Fischer
-
Method Summary
Modifier and TypeMethodDescriptionint
The number of physical database records processed.boolean
Whether or not the current NarrowedPageable request represents a forward progression, or a backwards progression.void
setUnderlyingPageSize
(int underlyingPageSize) The number of physical database records processed.Methods inherited from interface org.springframework.data.domain.Pageable
first, getOffset, getPageSize, getSort, getSortOr, hasPrevious, isPaged, isUnpaged, next, previousOrFirst, toOptional, toScrollPosition, withPage
Methods inherited from interface com.broadleafcommerce.data.tracking.core.filtering.UnnumberedPageable
getPageNumber
-
Method Details
-
getUnderlyingPageSize
int getUnderlyingPageSize()The number of physical database records processed. This can be different than the narrowed records returned in a page.- Returns:
- The number of physical database records processed
-
setUnderlyingPageSize
void setUnderlyingPageSize(int underlyingPageSize) The number of physical database records processed. This can be different than the narrowed records returned in a page in the case of a query against items that need to be narrowed. In the case of a query that is not being narrowed, this will always be equal toPageable.getPageSize()
- Parameters:
underlyingPageSize
- The number of physical database records processed
-
isForward
boolean isForward()Whether or not the current NarrowedPageable request represents a forward progression, or a backwards progression.- Returns:
- Whether or not the response page records should be in advance of the offset, or behind the offset.
-