cn.watsontech.webhelper.common.result.ResultList Maven / Gradle / Ivy
package cn.watsontech.webhelper.common.result;
import java.util.List;
/**
* Created by Watson on 2019/12/20.
*/
public class ResultList {
Boolean hasNext;
Integer offset;
Integer limit;
Long total;
List list;
public ResultList(List list) {
this.list = list;
this.total = this.list!=null?this.list.size():0l;
this.hasNext = calHasNext();
}
public ResultList(List list, Integer offset, Integer limit) {
this.offset = offset;
this.limit = limit;
this.list = list;
this.total = list!=null?list.size():0l;
this.hasNext = calHasNext();
}
public ResultList(List list, Integer offset, Integer limit, Long total) {
this.offset = offset;
this.limit = limit;
this.total = total;
this.list = list;
this.hasNext = calHasNext();
}
private boolean calHasNext() {
if (list!=null&&offset!=null&&total!=null) {
return offset+list.size() getList() {
return list;
}
public void setList(List list) {
this.list = list;
}
}