常用api返回对象
来源:互联网 发布:好看的淘宝女装店铺 编辑:程序博客网 时间:2024/06/05 16:24
后台返回结果给前台的对象
package cn.ink.api;public class ApiRes<T> { public static final Integer LOGIN_FAILURE = 101; // 用户登录失败 public static final Integer PARAM_REE = 102; // 参数传递错误 public static final Integer SERVER_ERR = 103; // 程序错误 public static final Integer ID_PW_ERR = 104; // 账号或密码错误 public static final Integer LOGIN_FORBID = 105; // 用户被禁止登录 // public static final Integer ... private boolean success; // 返回状态 private String msg; // 返回消息 private T rows; // 返回结果 private Integer status; // 返回状态 public ApiRes() { } public ApiRes(boolean success) { this.success = success; } public ApiRes(T rows) { this.rows = rows; } public ApiRes(boolean success, String msg, Integer status) { this.success = success; this.msg = msg; this.status = status; } public ApiRes(boolean success, String msg) { this.success = success; this.msg = msg; } public ApiRes(boolean success, String msg, T rows, Integer status) { this.success = success; this.msg = msg; this.rows = rows; this.status = status; } public ApiRes(boolean success, String msg, T rows) { this.success = success; this.msg = msg; this.rows = rows; } public ApiRes(String msg, Integer status) { this.msg = msg; this.status = status; } public static ApiRes createError(String msg, int stutus) { return new ApiRes(false, msg, stutus); } public static ApiRes createError(String msg) { return new ApiRes(false, msg, 0); } public static ApiRes createSuccess(String msg) { return new ApiRes(true, msg); } public static <T> ApiRes createSuccess(T vo) { return new ApiRes(true, "", vo); } public boolean isSuccess() { return success; } public void setSuccess(boolean success) { this.success = success; } public String getMsg() { return msg; } public void setMsg(String msg) { this.msg = msg; } public T getRows() { return rows; } public void setRows(T rows) { this.rows = rows; } public Integer getStatus() { return status; } public void setStatus(Integer status) { this.status = status; }}
阅读全文
0 0
- 常用api返回对象
- 数组对象常用API
- String对象常用API
- 常用API对象
- java_常用对象API
- 黑马程序员---常用API对象
- Response对象和常用API
- Calendar日历对象常用API
- web api 返回多个对象集合
- 常用对象API(String类-特点)
- 常用对象API(collection方法的使用。)
- 常用对象API(集合框架--迭代器)
- 【Java重新学习】常用API对象-String
- 黑马程序员_常用对象API
- 黑马程序员----JAVA基础----常用对象API
- JAVA 常用API String 对象 学习笔记
- Webkit之常用对象API梳理
- 黑马程序员--自学笔记--常用对象API
- Android之xxx is not a concrete class解决办法
- 第三周项目1(2)
- python 多维切片之冒号和三个点
- Mac下,eclipse初始化chrome浏览器driver的写法
- python 试题:请写一个类,实现一个stack类,要求类中包含至少一个特殊方法。
- 常用api返回对象
- TF-IDF与余弦相似性的应用(一):自动提取关键词
- C#梳理【正则表达式】
- Nginx配置反向代理
- Flex 布局
- req.status==0
- clojure实战——binding vs let
- webpack(2):Loader
- js中关于ASCII码、进制的转换