All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.jerryxia.devutil.dataobject.web.response.SimpleRes Maven / Gradle / Ivy

/**
 * 
 */
package com.github.jerryxia.devutil.dataobject.web.response;

import java.util.HashMap;
import java.util.Map;

/**
 * @author Administrator
 *
 */
public class SimpleRes {
    private int                 code;
    private String              msg;
    private Map data;

    public SimpleRes() {
        this.code = SimpleResCode.Ok.getValue();
        this.msg = "";
        this.data = new HashMap(8);
    }

    public SimpleRes(int c, String message, Map d) {
        this.code = c;
        this.msg = message == null ? "" : message;
        this.data = d;
    }

    public SimpleRes fail() {
        this.code = SimpleResCode.Fail.getValue();
        return this;
    }

    public SimpleRes msg(String message) {
        this.msg = message == null ? "" : message;
        return this;
    }

    public SimpleRes failWithMsg(String message) {
        return fail().msg(message == null ? "" : message);
    }

    public int getCode() {
        return code;
    }

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

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg == null ? "" : msg;
    }

    public Map getData() {
        return data;
    }

    public void setData(Map data) {
        this.data = data;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy