com.lone.common.core.json.AjaxJson Maven / Gradle / Ivy
The newest version!
package com.lone.common.core.json;
import java.util.Map;
import com.alibaba.fastjson.JSONObject;
/**
* $.ajax后需要接受的JSON
*
* @author
*
*/
public class AjaxJson {
private boolean success = true;// 是否成功
private String message = "操作成功";// 提示信息
private Object obj = null;// 其他信息
private Map attributes;// 其他参数
public Map getAttributes() {
return attributes;
}
public void setAttributes(Map attributes) {
this.attributes = attributes;
}
public String getMessage() {
return message;
}
public void setMessage(String msg) {
this.message = msg;
}
public Object getObj() {
return obj;
}
public void setObj(Object obj) {
this.obj = obj;
}
public boolean isSuccess() {
return success;
}
public void setSuccess(boolean success) {
this.success = success;
}
public String getJsonStr(){
JSONObject obj = new JSONObject();
obj.put("success", this.isSuccess());
obj.put("message", this.getMessage());
obj.put("obj", this.obj);
obj.put("attributes", this.attributes);
return obj.toJSONString();
}
}