这是本人常用的返回数据类
package com.pobo.pbcfgcenter.manage.domain; import com.pobo.pbcfgcenter.manage.utils.Constants; import java.io.Serializable; public class Resultimplements Serializable{ private static final long serialVersionUID = -7938378478392182545L; private int errorCode; private String msg; private T body; public static Result ofSuccess() { return new Result(Constants.RET_OK, "success"); } public static Result ofSuccess(String msg) { return new Result(Constants.RET_OK, msg); } public static Result ofFailure(int errcode, String errmsg) { return new Result(errcode, errmsg); } public int getErrorCode() { return errorCode; } public void setErrorCode(int errorCode) { this.errorCode = errorCode; } public String getMsg() { return msg; } public void setMsg(String msg) { this.msg = msg; } public T getBody() { return body; } public Result setBody(T body) { this.body = body; return this; } public Result(int errorCode, String msg) { super(); this.errorCode = errorCode; this.msg = msg; } public Result() { super(); } public Result(int errorCode, String msg, T body) { super(); this.errorCode = errorCode; this.msg = msg; this.body = body; } public Result(int errorCode, String msg, String token, T body) { super(); this.errorCode = errorCode; this.msg = msg; this.body = body; } }
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)