goja.mvc.AjaxSimple Maven / Gradle / Ivy
The newest version!
package goja.mvc;
import java.io.Serializable;
/**
* 简单格式的Ajax数据封装类
*
* @author sogYF
* @version 1.0
* @since JDK 1.6
*/
public class AjaxSimple implements Serializable {
private static final long serialVersionUID = -8792299524734422099L;
/**
* 请求是否成功
*/
private final boolean success;
/**
* 消息
*/
private final String msg;
private final String code;
private final E data;
private AjaxSimple(boolean success, String msg, String code, E data) {
this.success = success;
this.msg = msg;
this.code = code;
this.data = data;
}
public static Builder Builder() {
return new Builder();
}
public E getData() {
return data;
}
public boolean isSuccess() {
return success;
}
public String getMsg() {
return msg;
}
public String getCode() {
return code;
}
public static class Builder {
private boolean success;
private String msg;
private String code;
private B data;
public Builder setSuccess(boolean success) {
this.success = success;
return this;
}
public Builder setMsg(String msg) {
this.msg = msg;
return this;
}
public Builder setData(B data) {
this.data = data;
return this;
}
public Builder setCode(String code) {
this.code = code;
return this;
}
public AjaxSimple create() {
return new AjaxSimple(success, msg, code, data);
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy