pers.clare.hisql.page.Page Maven / Gradle / Ivy
The newest version!
package pers.clare.hisql.page;
import java.util.Collections;
import java.util.List;
@SuppressWarnings("unused")
public class Page {
private final int page;
private final int size;
private final List records;
private final long total;
public Page(int page, int size, List records, long total) {
this.page = page;
this.size = size;
this.records = records;
this.total = total;
}
public static Page of(int page, int size, List records, long total) {
return new Page<>(page, size, records, total);
}
public static Page empty() {
return new Page<>(0, 20, Collections.emptyList(), 0);
}
public static Page empty(Pagination pagination) {
return new Page<>(pagination.getPage(), pagination.getSize(), Collections.emptyList(), 0);
}
public int getPage() {
return page;
}
public int getSize() {
return size;
}
public List getRecords() {
return records;
}
public long getTotal() {
return total;
}
}