/** * Copyright (C) 2015. Keegan小钢(http://keeganlee.me) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.cheng.mvcframestudy.keeganmvc.api; /** * Api响应结果的封装类. * * @author Keegan小钢 * @date 15/6/21 * @version 1.0 */ public class ApiResponse<T> { private String event; // 返回码,0为成功 private String msg; // 返回信息 private T obj; // 单个对象 private T objList; // 数组对象 private int currentPage; // 当前页数 private int pageSize; // 每页显示数量 private int maxCount; // 总条数 private int maxPage; // 总页数 public ApiResponse(String event, String msg) { this.event = event; this.msg = msg; } public boolean isSuccess() { return event.equals("0"); } public String getEvent() { return event; } public void setEvent(String event) { this.event = event; } public String getMsg() { return msg; } public void setMsg(String msg) { this.msg = msg; } public T getObj() { return obj; } public void setObj(T obj) { this.obj = obj; } public T getObjList() { return objList; } public void setObjList(T objList) { this.objList = objList; } public int getCurrentPage() { return currentPage; } public void setCurrentPage(int currentPage) { this.currentPage = currentPage; } public int getPageSize() { return pageSize; } public void setPageSize(int pageSize) { this.pageSize = pageSize; } public int getMaxCount() { return maxCount; } public void setMaxCount(int maxCount) { this.maxCount = maxCount; } public int getMaxPage() { return maxPage; } public void setMaxPage(int maxPage) { this.maxPage = maxPage; } }