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

com.github.jerryxia.devutil.dataobject.service.output.SimpleOutput Maven / Gradle / Ivy

/**
 * 
 */
package com.github.jerryxia.devutil.dataobject.service.output;

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

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

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

    public SimpleOutput(int c, String message, Map d) {
        this.code = c;
        this.msg = message;
        this.data = d;
    }

    public SimpleOutput fail() {
        this.code = SimpleOutputCode.Fail.getValue();
        return this;
    }

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

    public SimpleOutput 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