/**
* Response Structure
* @author Yliu
*/
public class Resultutil<t> {
Responding to business status
Private Integer status;
Response message
Private String msg;
Data in the response
Private T data;
Public Integer GetStatus () {
return status;
}
public void SetStatus (Integer status) {
This.status = status;
}
Public String getmsg () {
return msg;
}
public void Setmsg (String msg) {
this.msg = msg;
}
Public T GetData () {
return data;
}
public void SetData (T data) {
This.data = data;
}
public resultutil (Integer status, String msg, T data) {
This.status = status;
this.msg = msg;
this.data = data;
&NBSP;&NBSP;}
public resultutil (T data) {
this.status = $;
this.msg = "Success";
this.data = data;
}
Public Resultutil () {
This.status = 2001;
this.msg = "Error";
This.data = null;
}
public static <T> resultutil<t> success (T data) {
return new resultutil<t> (data);
}
public static <T> resultutil<t> error (T data) {
return new Resultutil<t> (2001, "error", data);
}
@Override
Public String toString () {
Return "Resultutil [status=" + Status + ", msg=" + msg + ", data=" + Data + "]";
}
}
Java Response Result Tool class, customizable response code, content, Response message