package com.ag.util;

import java.io.Serializable;

/**
 * Created by Administrator on 2017/5/18 0018.
 */
public class Result implements Serializable {

    private boolean success;
    private String msg;
    private Object obj;
    private Integer code;

    public static Result build(boolean isSuccess) {
        Result result = new Result();
        result.setSuccess(isSuccess);
        return result;
    }
    public static Result build(boolean isSuccess, Object obj) {
        Result result = new Result();
        result.setSuccess(isSuccess);
        result.setObj(obj);
        return result;
    }
    public static Result build(boolean isSuccess, String msg) {
        Result result = new Result();
        result.setSuccess(isSuccess);
        result.setMsg(msg);
        return result;
    }
    public static Result build(boolean isSuccess, Object obj, String msg) {
        Result result = new Result();
        result.setSuccess(isSuccess);
        result.setObj(obj);
        result.setMsg(msg);
        return result;
    }
    public static Result build(boolean isSuccess, Object obj, String msg, Integer code) {
        Result result = new Result();
        result.setSuccess(isSuccess);
        result.setCode(code);
        result.setMsg(msg);
        result.setObj(obj);
        return result;
    }


    public boolean isSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getObj() {
        return obj;
    }

    public void setObj(Object obj) {
        this.obj = obj;
    }

    public Integer getCode() {
        if (code == null)
            code = 0;
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

}