All Downloads are FREE. Search and download functionalities are using the official Maven repository.

tech.jhipster.web.util.PageRecord Maven / Gradle / Ivy

package tech.jhipster.web.util;

import java.util.ArrayList;
import java.util.List;

public class PageRecord {
    private long total = 0;

    private long page = 0;

    private long size = 15;

    private long pages = 0;

    private List records = new ArrayList<>();

    public PageRecord() {
    }

    public PageRecord(long total, List records, long page, long size) {
        this.total = total;
        this.records = records;
        this.page = page;
        this.size = size;
    }

    public long getTotal() {
        return total;
    }

    public void setTotal(long total) {
        this.total = total;
    }

    public long getSize() {
        return size;
    }

    public void setSize(long size) {
        this.size = size;
    }

    public List getRecords() {
        return records;
    }

    public void setRecords(List records) {
        this.records = records;
    }

    public long getPage() {
        return page;
    }

    public void setPage(long page) {
        this.page = page;
    }

    public long getPages() {
        if (this.size == 0 || this.total == 0) {
            return 0;
        }
        if (this.total % this.size == 0) {
            return this.total / this.size;
        } else {
            return this.total / this.size + 1;
        }
    }

    public PageRecord records(List records) {
        this.records = records;
        return this;
    }

    public PageRecord total(long total) {
        this.total = total;
        return this;
    }

    public PageRecord size(long size) {
        this.size = size;
        return this;
    }

    public PageRecord page(long page) {
        this.page = page;
        return this;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy