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

com.heroku.api.request.RequestConfig Maven / Gradle / Ivy

package com.heroku.api.request;

import com.heroku.api.Heroku;

import java.util.EnumMap;
import java.util.Map;

/**
 * TODO: Javadoc
 *
 * @author Naaman Newbold
 */
public class RequestConfig {
    private final Map config = new EnumMap(Heroku.RequestKey.class);

    public RequestConfig onStack(Heroku.Stack stack) {
        return with(Heroku.RequestKey.Stack, stack.value);
    }

    public RequestConfig app(String appName) {
        return with(Heroku.RequestKey.AppName, appName);
    }

    public RequestConfig with(Heroku.RequestKey key, String value) {
        RequestConfig newConfig = new RequestConfig();
        newConfig.config.putAll(config);
        newConfig.config.put(key, value);
        return newConfig;
    }

    public String get(Heroku.RequestKey key) {
        return config.get(key);
    }
    
    public Map asMap() {
        return config;
    }

    public boolean has(Heroku.RequestKey key){
        return config.containsKey(key);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy