// // Source code recreated from a .class file by IntelliJ IDEA // (powered by FernFlower decompiler) // package com.chinaztt.mes.docx.util; import com.chinaztt.mes.docx.constant.CommonConstants; import java.io.Serializable; public class R implements Serializable { private static final long serialVersionUID = 1L; // "返回标记:成功标记=0,失败标记=1" private int code; // "返回信息" private String msg; // "数据" private T data; public static R ok() { return restResult(null, CommonConstants.SUCCESS, (String) null); } public static R ok(T data) { return restResult(data, CommonConstants.SUCCESS, (String) null); } public static R ok(T data, String msg) { return restResult(data, CommonConstants.SUCCESS, msg); } public static R failed() { return restResult(null, CommonConstants.FAIL, (String) null); } public static R failed(String msg) { return restResult(null, CommonConstants.FAIL, msg); } public static R failed(T data) { return restResult(data, CommonConstants.FAIL, (String) null); } public static R failed(T data, String msg) { return restResult(data, CommonConstants.FAIL, msg); } private static R restResult(T data, int code, String msg) { R apiResult = new R(); apiResult.setCode(code); apiResult.setData(data); apiResult.setMsg(msg); return apiResult; } public static RBuilder builder() { return new RBuilder(); } public String toString() { return "R(code=" + this.getCode() + ", msg=" + this.getMsg() + ", data=" + this.getData() + ")"; } public R() { } public R(int code, String msg, T data) { this.code = code; this.msg = msg; this.data = data; } public int getCode() { return this.code; } public R setCode(int code) { this.code = code; return this; } public String getMsg() { return this.msg; } public R setMsg(String msg) { this.msg = msg; return this; } public T getData() { return this.data; } public R setData(T data) { this.data = data; return this; } public static class RBuilder { private int code; private String msg; private T data; RBuilder() { } public RBuilder code(int code) { this.code = code; return this; } public RBuilder msg(String msg) { this.msg = msg; return this; } public RBuilder data(T data) { this.data = data; return this; } public R build() { return new R(this.code, this.msg, this.data); } public String toString() { return "R.RBuilder(code=" + this.code + ", msg=" + this.msg + ", data=" + this.data + ")"; } } }