1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/**
* Created by wolf on 2017/9/16.
*/
public class Res<T> {

private int code = 0;
private T data;
private String msg = "";
private String error = "";

public static Res ok = new Res();
public static Res fail = new Res().code(-1);

public static Res build() {
return new Res();
}

public static <T> Res build(T data){
return new Res().data(data);
}

public Res code(int code) {
this.code = code;
return this;
}

public Res data(T data) {
this.data = data;
return this;
}

public Res msg(String msg) {
this.msg = msg;
return this;
}

public Res error(String error) {
this.error = error;
return this;
}
//省略getter
}