com.cifaz.tools.dto.Result Maven / Gradle / Ivy
The newest version!
package com.cifaz.tools.dto;
public class Result extends BaseResult {
private static final long serialVersionUID = 3484073710784416152L;
private T data;
public Result() {
}
public static Result create() {
Result result = new Result();
result.setSuccess(false);
return result;
}
public Result success() {
this.success(null);
return this;
}
public Result success(T data) {
this.setSuccess(true);
this.data = data;
return this;
}
public Result fail(String code, String description) {
this.setSuccess(false);
this.setCode(code);
this.setDescription(description);
return this;
}
public Result fail(String code) {
this.fail(code, null);
return this;
}
public Result code(String code) {
this.setCode(code);
return this;
}
public Result description(String description) {
this.setDescription(description);
return this;
}
public Result sid(String sid) {
this.setSid(sid);
return this;
}
public Result data(T data) {
this.data = data;
return this;
}
public T getData() {
return this.data;
}
public void setData(T data) {
this.data = data;
}
}