package com.ytlib.pojo.response;
import com.ytlib.enums.WebHttpEnum;
public class Result<T> {
private Integer code;
private String msg;
private T data;
private Result(Integer code,String msg,T data){
this.code=code;
this.msg=msg;
this.data=data;
}
public static Result ok(){
return new Result(WebHttpEnum.SUCCESS.getCode(),WebHttpEnum.SUCCESS.getMsg(),null);
}
public static <T> Result ok(T data){
return new Result(WebHttpEnum.SUCCESS.getCode(),WebHttpEnum.SUCCESS.getMsg(),data);
}
public static <T> Result error(WebHttpEnum webHttpEnum){
return new Result(webHttpEnum.getCode(),webHttpEnum.getMsg(),null);
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public Object getData() {
return data;
}
public void setData(T data) {
this.data = data;
}
}