public class PageData<T>
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected int |
currentPage |
protected int |
firstIndex |
protected java.util.List<T> |
items |
protected int |
lastIndex |
protected int |
pageItemsCount |
protected int |
pageSize |
protected int |
totalItems |
protected int |
totalPages |
| Constructor and Description |
|---|
PageData() |
PageData(int page,
int size) |
PageData(int page,
int size,
int pageSize) |
PageData(int page,
int size,
int pageSize,
java.util.List<T> items)
Main constructor.
|
PageData(PageRequest req,
int size,
java.util.List<T> items) |
| Modifier and Type | Method and Description |
|---|---|
static int |
calcFirstItemIndexOfPage(int page,
int pageSize,
int total)
Calculates the first item index of requested page.
|
static int |
calcFirstItemIndexOfPage(PageRequest pageRequest,
int total)
Calculates first item index of the page.
|
static int |
calcPageOfItem(int itemIndex,
int pageSize)
Calculates page number that contains some item.
|
int |
getCurrentPage()
Returns current page number.
|
int |
getFirstIndex()
Returns index of the first item on this page.
|
java.util.List<T> |
getItems()
Returns the list of items on this page.
|
int |
getLastIndex()
Returns index of last item of page.
|
int |
getPageItemsCount()
Returns the number of shown items per page.
|
int |
getPageSize()
Returns page size, i.e. number of items per page.
|
int |
getTotalItems()
Returns total number of items.
|
int |
getTotalPages()
Returns total number of pages.
|
boolean |
hasNextPage()
Returns
true if there is a next page, i.e. we are not at the last page. |
boolean |
hasPreviousPage()
Returns
true if there is a previous page, i.e. we are not at the first page. |
boolean |
isFirstPage()
Returns
true id we are on the first page. |
boolean |
isLastPage()
Returns
true if we are on the last page. |
java.lang.String |
toString()
Convenient report method that can be used as JSON array.
|
protected final int pageSize
protected final int firstIndex
protected final int lastIndex
protected final java.util.List<T> items
protected final int totalItems
protected final int totalPages
protected int currentPage
protected final int pageItemsCount
public PageData()
public PageData(int page,
int size)
public PageData(int page,
int size,
int pageSize)
public PageData(PageRequest req, int size, java.util.List<T> items)
public PageData(int page,
int size,
int pageSize,
java.util.List<T> items)
page - current pagesize - total number of itemspageSize - number of items per pageitems - list of fetched itemspublic int getPageSize()
public int getFirstIndex()
public int getLastIndex()
public java.util.List<T> getItems()
public int getTotalItems()
public int getTotalPages()
public int getCurrentPage()
public int getPageItemsCount()
public boolean hasNextPage()
true if there is a next page, i.e. we are not at the last page.public boolean isLastPage()
true if we are on the last page.public boolean hasPreviousPage()
true if there is a previous page, i.e. we are not at the first page.public boolean isFirstPage()
true id we are on the first page.public java.lang.String toString()
toString in class java.lang.Objectpublic static int calcPageOfItem(int itemIndex,
int pageSize)
public static int calcFirstItemIndexOfPage(int page,
int pageSize,
int total)
public static int calcFirstItemIndexOfPage(PageRequest pageRequest, int total)
Copyright © 2003-present Jodd Team