//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
import java.util.Collections;
import java.util.List;
import org.apache.commons.lang.StringUtils; public class Page<T> { /*静态变量,用于设置结果是按照正序排列还是反序排列*/
public static final String ASC = "asc";
public static final String DESC = "desc"; /*当前页码*/
protected int pageNo = 1;
/*页面容量*/
protected int pageSize = 1;
/*orderBy表示通过那个进行排序,比如说:id*/
protected String orderBy = null;
/*order是设置以哪种方式进行排序:可以使ASC也可以是DESC*/
protected String order = null;
/*只是是否自动计算*/
protected boolean autoCount = true; /*以下2个参数常作为 分页所需的"返回结果"! */
//result表示当页面存在的实体类集合。
protected List<T> result = Collections.emptyList();
//totalCount表示当前页面总条数。
protected long totalCount = -1L; public Page() {
} public Page(int pageSize) {
this.setPageSize(pageSize);
} public Page(int pageSize, boolean autoCount) {
this.setPageSize(pageSize);
this.setAutoCount(autoCount);
} public int getPageNo() {
return this.pageNo;
} public void setPageNo(int pageNo) {
this.pageNo = pageNo;
if(pageNo < 1) {
this.pageNo = 1;
} } public int getPageSize() {
return this.pageSize;
} public void setPageSize(int pageSize) {
this.pageSize = pageSize;
if(pageSize < 0) {
this.pageSize = 1;
} } /**
* 获得当前页面第一条数据的排列
* @return
*/
public int getFirst() {
return (this.pageNo - 1) * this.pageSize + 1;
} public String getOrderBy() {
return this.orderBy;
} public void setOrderBy(String orderBy) {
this.orderBy = orderBy;
} public boolean isOrderBySetted() {
return StringUtils.isNotBlank(this.orderBy) && StringUtils.isNotBlank(this.order);
} public String getOrder() {
return this.order;
} public void setOrder(String order) {
String[] orders = StringUtils.split(StringUtils.lowerCase(order), ',');
String[] var6 = orders;
int var5 = orders.length; for(int var4 = 0; var4 < var5; ++var4) {
String orderStr = var6[var4];
if(!StringUtils.equals("desc", orderStr) && !StringUtils.equals("asc", orderStr)) {
throw new IllegalArgumentException("排序方向" + orderStr + "不是合法值");
}
} this.order = StringUtils.lowerCase(order);
} public boolean isAutoCount() {
return this.autoCount;
} public void setAutoCount(boolean autoCount) {
this.autoCount = autoCount;
} public List<T> getResult() {
return this.result;
} public void setResult(List<T> result) {
this.result = result;
} public long getTotalCount() {
return this.totalCount;
} public void setTotalCount(long totalCount) {
this.totalCount = totalCount;
} /**
* 获取一共有多少页(设置的是总条数)
* @return
*/
public long getTotalPages() {
if(this.totalCount < 0L) {
return -1L;
} else {
long count = this.totalCount / (long)this.pageSize;
if(this.totalCount % (long)this.pageSize > 0L) {
++count;
} return count;
}
} /**
* 是否还有下一页
* @return
*/
public boolean isHasNext() {
return (long)(this.pageNo + 1) <= this.getTotalPages();
} /**
* 得到下一页的页码
* @return
*/
public int getNextPage() {
return this.isHasNext()?this.pageNo + 1:this.pageNo;
} /**
* 是否有上一页
* @return
*/
public boolean isHasPre() {
return this.pageNo - 1 >= 1;
} /**
* 得到上一页页码
* @return
*/
public int getPrePage() {
return this.isHasPre()?this.pageNo - 1:this.pageNo;
}
}

对于上述代码需要有几点强调的:

1.Page类本质来讲仅仅是一个辅助类,其中包含的是一些争对分页的辅助数据,具体怎么用,还是需要自己进行处理的。

2.XXX随时补充。。。

org.springside.modules.orm中的page类自我解读的更多相关文章

  1. 三:理解Page类的运行机制(例:在render方法中生成静态文件)

    我这里只写几个常用的事件1.OnPreInit:此事件后将加载个性化信息和主题2.OnInit:初始化页面中服务器控件的默认值但控件的状态没有加载,没有创建控件树3.OnPreLoad:控件完成状态和 ...

  2. 在jsp中,page指令的()属性用来引入需要的包或类。

    在jsp中,page指令的()属性用来引入需要的包或类. A.extends B.import C.language D.contentType 解答:B

  3. orm中的聚合函数,分组,F/Q查询,字段类,事务

    目录 一.聚合函数 1. 基础语法 2. Max Min Sum Avg Count用法 (1) Max()/Min() (2)Avg() (3)Count() (4)聚合函数联用 二.分组查询 1. ...

  4. 领域模型中的实体类分为四种类型:VO、DTO、DO、PO

    http://kb.cnblogs.com/page/522348/ 由于不同的项目和开发人员有不同的命名习惯,这里我首先对上述的概念进行一个简单描述,名字只是个标识,我们重点关注其概念: 概念: V ...

  5. 【ASP.NET 基础】Page类和回调技术

    Page 类有一个 IsPostBack 属性,这个属性用来指示当前页面是第一次加载还是响应了页面上某个控件的服务器事件导致回发而加载. 1.asp.net页面的声明周期 asp.net页面运行的时候 ...

  6. C#基础系列:实现自己的ORM(反射以及Attribute在ORM中的应用)

    反射以及Attribute在ORM中的应用 一. 反射什么是反射?简单点吧,反射就是在运行时动态获取对象信息的方法,比如运行时知道对象有哪些属性,方法,委托等等等等.反射有什么用呢?反射不但让你在运行 ...

  7. (转载)OC学习篇之---Foundation框架中的其他类(NSNumber,NSDate,NSExcetion)

    前一篇说到了Foundation框架中的NSDirctionary类,这一一篇来看一下Foundation的其他常用的类:NSNumber,NSDate,NSException. 注:其实按照Java ...

  8. 深刻理解Python中的元类metaclass(转)

    本文由 伯乐在线 - bigship 翻译 英文出处:stackoverflow 译文:http://blog.jobbole.com/21351/ 译注:这是一篇在Stack overflow上很热 ...

  9. 非Page类使用session(Httpcontext.session和page.session区别)

    ASP.NET中Session高级使用技巧 在开发Aspx .NET软件时,有时需要把常用的东西封装到一个非PAGE类中,文章介绍在非Page类中使用Session的方法. 一.PAGE参数法: 1. ...

随机推荐

  1. centos7配置ip

    vi /etc/sysconfig/network-scripts/ifcfg-enp0s3 ONBOOT=yes 重启ip服务 systemctl restart network.service 开 ...

  2. ASP:GB2312格式文本文件转换成UTF-8格式

    '-------------------------------------------------'函数名称:gb2utf_file'作用:利用AdoDb.Stream对象来把GB2312格式文本文 ...

  3. 做.net的早晚会用到,并且网上还没有这方面的正确资料或几乎很少

    原文网址:http://www.cnblogs.com/langu/archive/2012/03/23/2413990.html 一直以来,找安装程序的msi源文件路径得到的都是“system32” ...

  4. 从市场运营角度谈Uber中国的第一批用户是怎么来的

    声明:这篇文章是从http://www.010lm.com/redian/2016/0312/1206875.html转来的,分享给大家. 1)首先告诉用户Uber是做什么的?即培养用户品牌意识. 我 ...

  5. apache php 配置 CI 框架

    声明:配置域名需要用到  httpd.conf  httpd_vhosts.conf  (apache) 中两个文件 和   hosts (C:\Windows\System32\drivers\et ...

  6. 【转】Java 内部类种类及使用解析

    Java 内部类种类及使用解析 内部类Inner Class 将相关的类组织在一起,从而降低了命名空间的混乱. 一个内部类可以定义在另一个类里,可以定义在函数里,甚至可以作为一个表达式的一部分. Ja ...

  7. iOS 2.0 版本切入点

    转载自:http://www.infoq.com/cn/articles/Version_2_0 移动互联网如火如荼,iOS 应用+ Android 应用+ 手机站似乎成了所有互联网公司的标配,你的网 ...

  8. MonkeyRunner 实现自动点击截屏后与本地图库进行对比输出

    先说下本人是菜鸟,通过网上资料学习,终于调通了MonkeyRunner 实现自动点击截屏后与本地图库进行对比输出,以后做静态UI测试就不需要眼睛盯着看图了,这一切交给MonkeyRunner了. 首先 ...

  9. Linux -- 统计文件的行数

    统计单个文件有多少行 方法1: awk '{print NR}' test1.sh|tail -n1 方法2: awk 'END{print NR}' test1.sh 方法3: grep -n &q ...

  10. PAT (Advanced Level) 1107. Social Clusters (30)

    简单并查集. #include<cstdio> #include<cstring> #include<cmath> #include<vector> # ...