Package com.aquima.web.rest.v1.paginator
Interface IPaginator<T>
- Type Parameters:
T
- the resource type
- All Known Implementing Classes:
FilteringPaginator
,NonFilteringPaginator
,Paginator
public interface IPaginator<T>
Converts a list of REST resources into a PagedObject containing some or all of those resources. Also adds and
provides information about the current page, page size, first page, last page, number of pages, and so on.
Page numbers use a 0-based index (first page = 0).
- Since:
- 9.6
- Author:
- Radu Batori
-
Method Summary
Modifier and TypeMethodDescriptionReturns the index of the next page.Returns the index of the previous page.boolean
boolean
void
paginateList
(PagedObject<T> pagedObject) Paginates the resources and places them in the provided pagedObject.
-
Method Details
-
getPageSize
Integer getPageSize()- Returns:
- the page size (number of resources per page)
-
getPageNumber
Integer getPageNumber()- Returns:
- the index current page number
-
getFirstPage
Integer getFirstPage()- Returns:
- the index of the first page
-
getLastPage
Integer getLastPage()- Returns:
- the index of the last page
-
getPrevPage
Integer getPrevPage()Returns the index of the previous page. If the current page is also the first page, the index of the previous page equals the index of the first page.- Returns:
- the index of the previous page.
-
getNextPage
Integer getNextPage()Returns the index of the next page. If the current page is also the last page, the index of the next page equals the index of the last page.- Returns:
- the index of the next page
-
getNumberOfItems
Integer getNumberOfItems()- Returns:
- the total number of items (prior to pagination).
-
getNumberOfPages
Integer getNumberOfPages()- Returns:
- the total number of pages (after pagination).
-
hasPrevPage
boolean hasPrevPage()- Returns:
- true if there is a previous page.
-
hasNextPage
boolean hasNextPage()- Returns:
- true if there is a next page.
-
paginateList
Paginates the resources and places them in the provided pagedObject. Also sets pagination-related properties on pagedObject.- Parameters:
pagedObject
- the resource where the paginated resources are placed
-