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

com.foresee.api.sdk.common.Environment Maven / Gradle / Ivy

There is a newer version: 1.2.4-M3
Show newest version
package com.foresee.api.sdk.common;


import com.google.common.collect.HashMultimap;
import com.google.common.collect.Iterables;
import com.google.common.collect.Multimap;
import lombok.Getter;

import java.util.NoSuchElementException;

@Getter
public enum Environment {
    DEVELOPMENT("dev","https://api-dev.foresee.com"),
    QA("qa","https://api-qa.foresee.com"),
    STAGING("stg","https://api-stage.foresee.com"),
    PRODUCTION("prod","https://api.foresee.com");

    /** Static Map to store */
    private static Multimap map = HashMultimap.create();

    /** String representation Value indicating the type of environment */
    private final String value;

    /** Corresponding API URL */
    private final String gatewayBaseUrl;

    /**
     * Private constructor to initialize the enum
     * @param val The string representation for this enum
     */
    private Environment(final String val, final String gatewayUrl) {
        this.value = val;
        this.gatewayBaseUrl = gatewayUrl;
    }

    /**
     * Construct the map of Environments
     */
    static {
        for (Environment environment : Environment.values()) {
            map.put(environment.value, environment);
        }
    }

    public static Environment fromString(String val) {
        if (map.containsKey(val)) {
            return Iterables.get(map.get(val), 0);
        }
        throw new NoSuchElementException(val + " not found");
    }

    public String toString() {
        return value;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy