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

cn.sylinx.hbatis.db.common.Page Maven / Gradle / Ivy

There is a newer version: 2.0.0.RELEASE
Show newest version
package cn.sylinx.hbatis.db.common;

import java.io.Serializable;
import java.util.List;

@SuppressWarnings("serial")
public class Page implements Serializable {

	private List list; // list result of this page
	private int pageNumber; // page number
	private int pageSize; // result amount of this page
	private int totalPage; // total page
	private int totalRow; // total row

	public Page() {
	}

	/**
	 * Constructor.
	 * 
	 * @param list
	 *            the list of paginate result
	 * @param pageNumber
	 *            the page number
	 * @param pageSize
	 *            the page size
	 * @param totalPage
	 *            the total page of paginate
	 * @param totalRow
	 *            the total row of paginate
	 */
	public Page(List list, int pageNumber, int pageSize, int totalPage, int totalRow) {
		this.list = list;
		this.pageNumber = pageNumber;
		this.pageSize = pageSize;
		this.totalPage = totalPage;
		this.totalRow = totalRow;
	}

	public boolean isEmpty() {
		return list == null || list.isEmpty();
	}

	/**
	 * Return list of this page.
	 */
	public List getList() {
		return list;
	}

	/**
	 * Return page number.
	 */
	public int getPageNumber() {
		return pageNumber;
	}

	/**
	 * Return page size.
	 */
	public int getPageSize() {
		return pageSize;
	}

	/**
	 * Return total page.
	 */
	public int getTotalPage() {
		return totalPage;
	}

	/**
	 * Return total row.
	 */
	public int getTotalRow() {
		return totalRow;
	}

	/**
	 * set the data list
	 * 
	 * @param list
	 *            the data list
	 * @return Page object
	 */
	public Page setList(List list) {
		this.list = list;
		return this;
	}

	/**
	 * set the page number
	 * 
	 * @param pageNumber
	 *            the page number
	 * @return Page object
	 */
	public Page setPageNumber(int pageNumber) {
		this.pageNumber = pageNumber;
		return this;
	}

	/**
	 * set the page size
	 * 
	 * @param pageSize
	 *            the page size
	 * @return Page object
	 */
	public Page setPageSize(int pageSize) {
		this.pageSize = pageSize;
		return this;
	}

	/**
	 * set the total page
	 * 
	 * @param totalPage
	 *            the total page
	 * @return Page object
	 */
	public Page setTotalPage(int totalPage) {
		this.totalPage = totalPage;
		return this;
	}

	/**
	 * set the total row count
	 * 
	 * @param totalRow
	 *            the total row count
	 * @return Page object
	 */
	public Page setTotalRow(int totalRow) {
		this.totalRow = totalRow;
		return this;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy