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

lphystudio.app.cmd.Arguments Maven / Gradle / Ivy

The newest version!
package lphystudio.app.cmd;

import lphy.core.model.Value;

import java.util.Map;

/**
 * Created by Alexei Drummond on 10/03/20.
 */
public class Arguments {

    Map> arguments;

    public Arguments(Map> arguments) {
        this.arguments = arguments;
    }

    public boolean getBoolean(String name, Object defaultValue) {
        Value val = arguments.get(name);
        if (val == null) return (Boolean)defaultValue;
        return (Boolean)val.value();
    }

    public int getInteger(String name, Object defaultValue) {
        Value val = arguments.get(name);
        if (val == null) return (Integer)defaultValue;
        return (Integer) val.value();
    }

    public double getDouble(String name, Object defaultValue) {
        Value val = arguments.get(name);
        if (val == null) return (Double)defaultValue;
        return (Double) val.value();
    }

    public String getString(String name, Object defaultValue) {
        Value val = arguments.get(name);
        if (val == null) return defaultValue.toString();
        return (String) val.value();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy