Interface PageRequest
-
- All Known Implementing Classes:
PageRequestImpl
public interface PageRequestAbstract interface for pagination information. See Spring Data Commons, but more flat design and independent of Spring libraries.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classPageRequest.Builder
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static PageRequest.BuilderdefaultBuilder()PageRequestfirst()Returns thePageRequestrequesting the first page.intgetOffset()Returns the offset to be taken according to the underlying page and page size.intgetPageNumber()Returns the page to be returned.intgetPageSize()Returns the number of items to be returned.SortinggetSorting()Returns the sorting parameters.booleanhasPrevious()Returns whether there's a previousPageRequestwe can access from the current one.PageRequestnext()Returns thePageRequestrequesting the next page.PageRequestpreviousOrFirst()Returns the previousPageRequestor the firstPageRequestif the current one already is the first one.voidsetPageSize(int pageSize)Sets the number of items.voidsetSorting(Sorting sorting)Sets the sorting parameters.
-
-
-
Method Detail
-
getPageNumber
int getPageNumber()
Returns the page to be returned.- Returns:
- the page to be returned.
-
getPageSize
int getPageSize()
Returns the number of items to be returned.- Returns:
- the number of items of that page
-
getOffset
int getOffset()
Returns the offset to be taken according to the underlying page and page size.- Returns:
- the offset to be taken
-
getSorting
Sorting getSorting()
Returns the sorting parameters.- Returns:
- the sorting parameters
-
next
PageRequest next()
Returns thePageRequestrequesting the next page.- Returns:
- the PageRequest requesting the next page
-
previousOrFirst
PageRequest previousOrFirst()
Returns the previousPageRequestor the firstPageRequestif the current one already is the first one.- Returns:
- the previous PageRequest or the first PageRequest if the current one already is the first one
-
first
PageRequest first()
Returns thePageRequestrequesting the first page.- Returns:
- the PageRequest requesting the first page
-
hasPrevious
boolean hasPrevious()
Returns whether there's a previousPageRequestwe can access from the current one. Will return false in case the currentPageRequestalready refers to the first page.- Returns:
- whether there's a previous PageRequest
-
setPageSize
void setPageSize(int pageSize)
Sets the number of items.- Parameters:
pageSize- the number of items of that page
-
setSorting
void setSorting(Sorting sorting)
Sets the sorting parameters.- Parameters:
sorting- the sorting parameters
-
defaultBuilder
static PageRequest.Builder defaultBuilder()
-
-