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

com.github.ltsopensource.cmd.HttpCmdRequest Maven / Gradle / Ivy

package com.github.ltsopensource.cmd;

import com.github.ltsopensource.core.commons.utils.StringUtils;

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

/**
 * @author Robert HG ([email protected]) on 10/26/15.
 */
public class HttpCmdRequest {

    private String command;
    private String nodeIdentity;

    private Map params;

    public String getCommand() {
        return command;
    }

    public void setCommand(String command) {
        this.command = command;
    }

    public String getNodeIdentity() {
        return nodeIdentity;
    }

    public void setNodeIdentity(String nodeIdentity) {
        this.nodeIdentity = nodeIdentity;
    }

    public void setParams(Map params) {
        this.params = params;
    }

    public String getParam(String key) {
        if (params != null) {
            return params.get(key);
        }
        return null;
    }

    public String getParam(String key, String defaultValue) {
        if (params != null) {
            String value = params.get(key);
            if (StringUtils.isEmpty(value)) {
                return defaultValue;
            }
            return value;
        }
        return null;
    }

    public void addParam(String key, String value) {
        if (params == null) {
            params = new HashMap();
        }
        params.put(key, value);
    }

    public Map getParams() {
        return params;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy