org.sophon.commons.pager.PageResult Maven / Gradle / Ivy
The newest version!
package org.sophon.commons.pager;
import java.io.Serializable;
import java.util.Collections;
import java.util.List;
/**
* 分页结果
* @author moushaokun
* @since time: 2023-02-16 21:55
*/
public final class PageResult implements Serializable {
private static final long serialVersionUID = 4812489885816940728L;
/** 数据集 */
private List list;
/** 总量 */
private Long total;
public PageResult() {}
public List getList() {
return list == null ? Collections.emptyList() : list;
}
public PageResult setList(List list) {
this.list = list;
return this;
}
public Long getTotal() {
return total == null ? 0L : total;
}
public PageResult setTotal(Long total) {
this.total = total;
return this;
}
@Override
public String toString() {
return "PageResult(list=" + this.getList() + ", total=" + this.getTotal() + ")";
}
public static PageResult of(List list, Long total){
return new PageResult().setList(list).setTotal(total);
}
public static PageResult of(List list){
return new PageResult().setList(list);
}
public static PageResult of(Long total){
return new PageResult().setTotal(total);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy