An example of encapsulation code for Java to return paging result set

Time:2020-10-29

This article mainly introduces the Java returns pagination result set encapsulation code example, the article through the example code introduction is very detailed, has certain reference study value to everybody’s study or the work, needs the friend may refer to

The code is as follows

package com.leyou.common;
 
import java.util.List;
 
public class PageResult<T> {
 Private long total; // total
 Private integer totalpage; // total pages
 private List<T> list;
 
 public PageResult() {
 }
 
 public PageResult(long total, List<T> list) {
  this.total = total;
  this.list = list;
 }
 
 public PageResult(long total, Integer totalPage, List<T> list) {
  this.total = total;
  this.totalPage = totalPage;
  this.list = list;
 }
 
 public long getTotal() {
  return total;
 }
 
 public void setTotal(long total) {
  this.total = total;
 }
 
 public Integer getTotalPage() {
  return totalPage;
 }
 
 public void setTotalPage(Integer totalPage) {
  this.totalPage = totalPage;
 }
 
 public List<T> getList() {
  return list;
 }
 
 public void setList(List<T> list) {
  this.list = list;
 }
}

result

The above is the whole content of this article, I hope to help you in your study, and I hope you can support developeppaer more.

Recommended Today

Stack

Stack Basic concepts Logical structure definition Stack(stack): only allowed inone endTo insert or deleteLinear table。 Stack top(top): the end of a linear table that allows insertion and deletion. Stack bottomBottom: fixed end that cannot be inserted or deleted. Empty stack: an empty table without any elements. characteristic Last in first out(Last In First Out,LIFO) N […]