public class PageResult<E> extends R<Collection<E>> implements Iterable<E>
It is not recommended to change the page data after construction. page - 1-based, not less than 1. size - 1-based, not less than 1. sort - sort string totalPage - 1-based, not less than 1, calculated by data and size totalData - 0-based, not less than 0, not more than 2.1 billion. meta - in addition to data information.
R.Immutable<T>I18nAware.I18nSourcei18nArgs, i18nCode, message| Constructor and Description |
|---|
PageResult() |
| Modifier and Type | Method and Description |
|---|---|
PageResult<E> |
addData(Collection<E> ds) |
PageResult<E> |
addData(E e) |
PageResult<E> |
addMeta(String key,
Object value) |
static <T> PageResult<T> |
empty()
constructor an empty page result of total is 0, size is 1.
|
boolean |
equals(Object o) |
@NotNull Collection<E> |
getData()
the biz-data to caller
|
Map<String,?> |
getMeta() |
<T> T |
getMeta(String key) |
int |
getPage()
current page, 1-based, not less than 1.
|
int |
getSize()
page size, 1-based, not less than 1.
|
@Nullable String |
getSort()
Sorting String
|
int |
getTotalData()
0-based, not less than 0, not more than 2.1 billion.
|
int |
getTotalPage()
1-based, not less than 1, calculated by data and size.
|
int |
hashCode() |
<T> PageResult<T> |
into(Function<E,T> fun) |
@NotNull Iterator<E> |
iterator() |
static <T> PageResult<T> |
ok(int total,
Collection<T> data,
int page,
int size)
constructor
|
static <T> PageResult<T> |
ok(int total,
Collection<T> data,
PageQuery pg)
constructor
|
PageResult<E> |
setData(Collection<E> ds) |
PageResult<E> |
setMeta(Map<String,Object> meta) |
PageResult<E> |
setPage(int page) |
void |
setSize(int size) |
PageResult<E> |
setSort(String sort)
Sorting String
|
void |
setTotalData(int totalData) |
PageResult<E> |
setTotalInfo(int totalData,
int pageSize)
Set the total data and page size, then calculate the total page
|
void |
setTotalPage(int totalPage) |
@NotNull List<E> |
toList() |
String |
toString() |
applyLocale, castData, castData, getCause, getCause, getCode, getErrors, isSuccess, ng, NG, ng, ng, ng, ng, ng, ng, ngCause, ngCause, ngCause, ngCause, ngCause, ngCause, ngCode, ngCode, ngCodeMessage, ngError, ngError, ngError, ngError, ngError, ngMessage, ngMessage, of, of, of, of, of, of, of, ofCode, ofCode, ofCodeMessage, ofMessage, ofMessage, ok, OK, ok, ok, ok, ok, ok, ok, okCode, okCode, okCodeMessage, okMessage, okMessage, orCode, orCode, orCodeMessage, orData, orMessage, setCause, setCode, setCodeIfNg, setCodeIfNg, setCodeIfOk, setCodeIfOk, setCodeMessage, setCodeMessage, setCodeMessageIfNg, setCodeMessageIfNg, setCodeMessageIfOk, setCodeMessageIfOk, setDataIfNg, setDataIfNg, setDataIfOk, setDataIfOk, setErrors, setMessageIfNg, setMessageIfNg, setMessageIfOk, setMessageIfOk, setSuccessgetI18nArgs, getI18nCode, getI18nHint, getMessage, of, setI18nArgs, setI18nCode, setMessage, setMessageBy, setMessageBy, setMessageBy, setMessageByclone, finalize, getClass, notify, notifyAll, wait, wait, waitforEach, spliteratorgetErrorsIf, getErrorsOrgetI18nArgs, getI18nArgsIf, getI18nArgsOr, getI18nCode, getI18nCodeIf, getI18nCodeOr, getI18nHint, getI18nHintIf, getI18nHintOr, toI18nString, toI18nString, toI18nString, toString, toString, toStringcastpublic int getPage()
@Contract(value="_->this") public PageResult<E> setPage(int page)
public int getSize()
public void setSize(int size)
@Nullable public @Nullable String getSort()
PageUtil.sort(String)@Contract(value="_->this") public PageResult<E> setSort(String sort)
sort - Sorting stringPageUtil.sort(String)public int getTotalPage()
public void setTotalPage(int totalPage)
public int getTotalData()
public void setTotalData(int totalData)
@Contract(value="_,_->this") public PageResult<E> setTotalInfo(int totalData, int pageSize)
totalData - total countpageSize - page size@Contract(value="_->this") public PageResult<E> setData(Collection<E> ds)
setData in class R<Collection<E>>@NotNull public @NotNull Collection<E> getData()
DataAwaregetData in interface DataAware<Collection<E>>getData in class R<Collection<E>>@Contract(value="_->this") public PageResult<E> addData(E e)
@Contract(value="_->this") public PageResult<E> addData(Collection<E> ds)
@Contract(value="_->this") public PageResult<E> setMeta(Map<String,Object> meta)
@Contract(value="_,_->this") public PageResult<E> addMeta(String key, Object value)
public <T> T getMeta(String key)
public <T> PageResult<T> into(Function<E,T> fun)
public String toString()
toString in class R<Collection<E>>public boolean equals(Object o)
equals in class R<Collection<E>>public int hashCode()
hashCode in class R<Collection<E>>public static <T> PageResult<T> ok(int total, Collection<T> data, PageQuery pg)
T - data typetotal - total data countdata - current page of datapg - query of pagepublic static <T> PageResult<T> ok(int total, Collection<T> data, int page, int size)
T - data typetotal - total data countdata - current page of datapage - current pagesize - page sizepublic static <T> PageResult<T> empty()
Copyright © 2025. All rights reserved.