public class PaginationResult<O> extends Object implements Serializable
PaginationParameter
used to compute it. The class also contains methods to
navigate through the other pages.Modifier and Type | Field and Description |
---|---|
protected long |
count |
protected PaginationParameter |
currentPage |
protected List<O> |
elements |
Modifier | Constructor and Description |
---|---|
protected |
PaginationResult(List<O> elements,
long count,
PaginationParameter currentPage) |
Modifier and Type | Method and Description |
---|---|
static <T> PaginationResult<T> |
fromFullList(List<T> fullList,
PaginationParameter requestedPage)
Creates an instance using the full list of elements ({code}fullList{/code}) and the {code}requestedPage{/code}
PaginationParameter . |
long |
getCount() |
PaginationParameter |
getCurrentPage() |
List<O> |
getElements() |
PaginationParameter |
getFirstPage() |
PaginationParameter |
getLastPage() |
PaginationParameter |
getNextPage() |
int |
getPageCount() |
PaginationParameter |
getPreviousPage() |
boolean |
hasNextPage() |
boolean |
hasPreviousPage() |
static <T> PaginationResult<T> |
of(List<T> elements,
long count,
PaginationParameter currentPage)
Creates an instance using the already computed list of {code}elements{/code} and {code}count{/count}, together
with the {code}currentPage{/code}
PaginationParameter used to build it. |
<T> PaginationResult<T> |
transform(Function<? super O,? extends T> function)
Creates an instance of PaginationResult transforming the current one using the given function
|
protected long count
protected PaginationParameter currentPage
protected PaginationResult(List<O> elements, long count, PaginationParameter currentPage)
public static <T> PaginationResult<T> of(List<T> elements, long count, PaginationParameter currentPage)
PaginationParameter
used to build it.T
- any object typeelements
- the list of elementscount
- the total number of elements (through all pages)currentPage
- the PaginationParameter used to build this paged resultpublic static <T> PaginationResult<T> fromFullList(List<T> fullList, PaginationParameter requestedPage)
PaginationParameter
. The built instance of PaginationResult will contain a sub list of the given
{code}fullList{/code} parameter.T
- any object typefullList
- the full list of elementsrequestedPage
- the PaginationParameter to use to build this paged resultpublic long getCount()
public PaginationParameter getCurrentPage()
public PaginationParameter getNextPage()
public PaginationParameter getPreviousPage()
public PaginationParameter getFirstPage()
public PaginationParameter getLastPage()
public int getPageCount()
public boolean hasNextPage()
public boolean hasPreviousPage()
public <T> PaginationResult<T> transform(Function<? super O,? extends T> function)
Copyright © 2004–2020 CodeLutin. All rights reserved.