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

io.deepsense.neptune.clientlibrary.models.impl.parameters.OfflineJobParameters Maven / Gradle / Ivy

There is a newer version: 1.6.1
Show newest version
/**
 * Copyright (c) 2016, CodiLime Inc.
 */
package io.deepsense.neptune.clientlibrary.models.impl.parameters;

import io.deepsense.neptune.clientlibrary.models.JobParameters;
import io.deepsense.neptune.clientlibrary.models.Parameter;

import java.util.*;

public class OfflineJobParameters extends HashMap implements JobParameters {

    public OfflineJobParameters put(String name, String value) {
        put(name, ParameterImpl.createStringParameter(name, value));
        return this;
    }

    public OfflineJobParameters put(String name, Integer value) {
        put(name, ParameterImpl.createIntParameter(name, value));
        return this;
    }

    public OfflineJobParameters put(String name, Double value) {
        put(name, ParameterImpl.createDoubleParameter(name, value));
        return this;
    }

    public OfflineJobParameters put(String name, Boolean value) {
        put(name, ParameterImpl.createBooleanParameter(name, value));
        return this;
    }

    @Override
    public Parameter get(Object key) {
        if (!containsKey(key)) {
            System.err.format("neptune: Trying to access the '%s' parameter which is not defined.%n"
                    + "         In order to run a Neptune job offline, you need to provide all parameters%n"
                    + "         via command line or JobParameters argument of NeptuneContextFactory.createContext.",
                    key);
        }
        return super.get(key);
    }

    public static JobParameters emptyParameters() {
        return new OfflineJobParameters();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy