java 通用的返回类
2016-03-23 17:21
351 查看
package com.eshore.pdip.mobile.phone.vo;
import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.eshore.pdip.mobile.util.Pager;
import com.eshore.pdip.mobile.util.ResultCodes;
public class Result implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
/**
* ������
*/
private String resultCode = ResultCodes.INVOKE_SUCC;
private String msg;
private Object resultObj;
private List<?> resultList;
private String callback;
private int pageNo = 1; // ҳ��
private int pageSize = 10; // ÿҳ����
private int totalPageCount = 0; // ��ҳ��
private int totalCount = 0; // ������
private int currentPageNo = 1; // ������
public int getCurrentPageNo() {
return currentPageNo;
}
public void setCurrentPageNo(int currentPageNo) {
this.currentPageNo = currentPageNo;
}
private Map<String, Object> ignoreMap = new HashMap<String, Object>();
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public Object getResultObj() {
return resultObj;
}
public void setResultObj(Object resultObj) {
this.resultObj = resultObj;
}
public List<?> getResultList() {
return resultList;
}
public void setResultList(List<?> resultList) {
this.resultList = resultList;
}
public int getPageNo() {
return pageNo;
}
public void setPageNo(int pageNo) {
this.pageNo = pageNo;
}
public int getPageSize() {
return pageSize;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public int getTotalPageCount() {
return totalPageCount;
}
public void setTotalPageCount(int totalPageCount) {
this.totalPageCount = totalPageCount;
}
public int getTotalCount() {
return totalCount;
}
public void setTotalCount(int totalCount) {
this.totalCount = totalCount;
}
public Map<String, Object> getIgnoreMap() {
return ignoreMap;
}
public void setIgnoreMap(Map<String, Object> ignoreMap) {
this.ignoreMap = ignoreMap;
}
public String getCallback() {
return callback;
}
public void setCallback(String callback) {
this.callback = callback;
}
public String getResultCode() {
return resultCode;
}
public void setResultCode(String resultCode) {
this.resultCode = resultCode;
}
public void put(String key, Object value) {
this.ignoreMap.put(key, value);
}
public void initPagerResult(Pager pager) {
if (pager != null) {
this.pageNo = pager.getPageNumber();
this.pageSize = pager.getPageSize();
this.totalCount = pager.getTotalCount();
this.totalPageCount = pager.getPageCount();
this.currentPageNo=pager.getPageNumber();
}
}
@Override
public String toString() {
return "Result [resultCode=" + resultCode + ", msg=" + msg + "]";
}
}
import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.eshore.pdip.mobile.util.Pager;
import com.eshore.pdip.mobile.util.ResultCodes;
public class Result implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
/**
* ������
*/
private String resultCode = ResultCodes.INVOKE_SUCC;
private String msg;
private Object resultObj;
private List<?> resultList;
private String callback;
private int pageNo = 1; // ҳ��
private int pageSize = 10; // ÿҳ����
private int totalPageCount = 0; // ��ҳ��
private int totalCount = 0; // ������
private int currentPageNo = 1; // ������
public int getCurrentPageNo() {
return currentPageNo;
}
public void setCurrentPageNo(int currentPageNo) {
this.currentPageNo = currentPageNo;
}
private Map<String, Object> ignoreMap = new HashMap<String, Object>();
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public Object getResultObj() {
return resultObj;
}
public void setResultObj(Object resultObj) {
this.resultObj = resultObj;
}
public List<?> getResultList() {
return resultList;
}
public void setResultList(List<?> resultList) {
this.resultList = resultList;
}
public int getPageNo() {
return pageNo;
}
public void setPageNo(int pageNo) {
this.pageNo = pageNo;
}
public int getPageSize() {
return pageSize;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public int getTotalPageCount() {
return totalPageCount;
}
public void setTotalPageCount(int totalPageCount) {
this.totalPageCount = totalPageCount;
}
public int getTotalCount() {
return totalCount;
}
public void setTotalCount(int totalCount) {
this.totalCount = totalCount;
}
public Map<String, Object> getIgnoreMap() {
return ignoreMap;
}
public void setIgnoreMap(Map<String, Object> ignoreMap) {
this.ignoreMap = ignoreMap;
}
public String getCallback() {
return callback;
}
public void setCallback(String callback) {
this.callback = callback;
}
public String getResultCode() {
return resultCode;
}
public void setResultCode(String resultCode) {
this.resultCode = resultCode;
}
public void put(String key, Object value) {
this.ignoreMap.put(key, value);
}
public void initPagerResult(Pager pager) {
if (pager != null) {
this.pageNo = pager.getPageNumber();
this.pageSize = pager.getPageSize();
this.totalCount = pager.getTotalCount();
this.totalPageCount = pager.getPageCount();
this.currentPageNo=pager.getPageNumber();
}
}
@Override
public String toString() {
return "Result [resultCode=" + resultCode + ", msg=" + msg + "]";
}
}
相关文章推荐
- Spring中@Async用法总结
- Java过滤器与SpringMVC拦截器之间的关系与区别
- java垃圾回收机制和内存溢出
- struts2应用
- spring mvc 异步加载tree
- Java中jre 和 jdk 的区别
- java基础知识总结
- 管理Java垃圾回收的五个建议
- 设置eclipse自动下载源码
- 当spring 容器初始化完成后执行某个方法
- 管理Java垃圾回收的五个建议
- Java嵌入式数据库H2学习总结(三)——在Web应用中嵌入H2数据库
- java十七节-file前言
- Spring 实现数据库读写分离
- Java学习笔记(一)
- Java enum的用法详解
- 关于java Socket Connection timed out: connect
- Java嵌入式数据库H2学习总结(二)——在Web应用程序中使用H2数据库
- Java Executors(线程池)
- FlexBuilder3安装集成eclipse