//
// 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. (转载)解析ISO8583报文实例

    本篇文章参考了中国银联POS终端规范,所以如有不明白的可以去我的资源里面下载. 现在我们有ISO8583报文如下(十六进制表示法): 60 00 03 00 00(前五个字节为TPDU) 60 31 ...

  2. perl-cgi命令行调试

    来源: http://www.cnblogs.com/itech/archive/2012/09/23/2698838.html 参考: http://docstore.mik.ua/orelly/l ...

  3. pulseaudio的交叉编译

    在/etc/profile里导入 export PATH==$PATH:/home/jack/arm-linux-gcc/x-tools/arm-unknown-linux-gnueabi/bin 配 ...

  4. Inno Setup入门(十八)——Inno Setup类参考(4)

    分类: Install Setup 2013-02-02 11:29 406人阅读 评论(0) 收藏 举报 编辑框 编辑框也叫文本框,是典型的窗口可视化组件,既可以用来输入文本,也可以用来显示文本,是 ...

  5. 用GDB调试程序的设置 Segmentation fault(Core Dump)调试

    在写wifi库的时候碰见一个 Segmentation fault(Core Dump) 所以需要用GDB调试下. 在cmake的时候,修改CMakeLists.txt set(CMAKE_C_FLA ...

  6. ccw-ide

    有bug,会把working set弄乱,整理后能重启一次正常,再次重启又乱了.

  7. 2.2 sikuli中编程运行

    http://www.cnblogs.com/Flint/p/4951703.html a.如果需要指定点击的具体坐标,需要使用click(patten.targetoffset(x, y)). b. ...

  8. eclipse提升注解提示速度

    preference--输入content--java--editor--content Assist--aoto delay 选项 改为100或者更低  提示速度              --ao ...

  9. Struts2实现国际化

    public class I18nAction extends ActionSupport { private static final long serialVersionUID = -693330 ...

  10. JS的className,字体放大缩小

    <!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content ...