Package com.aquima.web.rest.v1.paginator
Class Paginator<T>
java.lang.Object
com.aquima.web.rest.v1.paginator.Paginator<T>
- Type Parameters:
T
- the resource type this paginator can handle
- All Implemented Interfaces:
IPaginator<T>
- Direct Known Subclasses:
FilteringPaginator
,NonFilteringPaginator
Base class for paginators.
- Author:
- Radu Batori
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetList()
Returns the index of the next page.Returns the index of the previous page.boolean
boolean
protected void
paginate
(PagedObject<T> pagedObject) If paging is enabled, sets page-related properties of the given paged object.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.aquima.web.rest.v1.paginator.IPaginator
paginateList
-
Constructor Details
-
Paginator
- Parameters:
list
- the resources to paginate (may be all resources or a page of resources)pageNumber
- the current page number (may be null - null disables pagination)pageSize
- the page size (may be null - disables pagination)itemCount
- the total item count (not necessarily equal to list size)
-
-
Method Details
-
getPageSize
- Specified by:
getPageSize
in interfaceIPaginator<T>
- Returns:
- the page size (number of resources per page)
-
getPageNumber
- Specified by:
getPageNumber
in interfaceIPaginator<T>
- Returns:
- the index current page number
-
getFirstPage
- Specified by:
getFirstPage
in interfaceIPaginator<T>
- Returns:
- the index of the first page
-
getLastPage
- Specified by:
getLastPage
in interfaceIPaginator<T>
- Returns:
- the index of the last page
-
getPrevPage
Description copied from interface:IPaginator
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.- Specified by:
getPrevPage
in interfaceIPaginator<T>
- Returns:
- the index of the previous page.
-
getNextPage
Description copied from interface:IPaginator
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.- Specified by:
getNextPage
in interfaceIPaginator<T>
- Returns:
- the index of the next page
-
getNumberOfItems
- Specified by:
getNumberOfItems
in interfaceIPaginator<T>
- Returns:
- the total number of items (prior to pagination).
-
getNumberOfPages
- Specified by:
getNumberOfPages
in interfaceIPaginator<T>
- Returns:
- the total number of pages (after pagination).
-
hasPrevPage
public boolean hasPrevPage()- Specified by:
hasPrevPage
in interfaceIPaginator<T>
- Returns:
- true if there is a previous page.
-
hasNextPage
public boolean hasNextPage()- Specified by:
hasNextPage
in interfaceIPaginator<T>
- Returns:
- true if there is a next page.
-
paginate
If paging is enabled, sets page-related properties of the given paged object.- Parameters:
pagedObject
- the resource where the paginated resources are placed
-
getList
-