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

io.soffa.foundation.core.context.Environment Maven / Gradle / Ivy

The newest version!
package io.soffa.foundation.core.context;


import java.util.Properties;

@SuppressWarnings("PMD.ClassNamingConventions")
public final class Environment {

    private static final Properties PROPS = new Properties();

    private Environment() {
    }

    public static void set(String key, Object value) {
        PROPS.put(key, value);
    }

    public static boolean containsKey(String key) {
        return PROPS.containsKey(key);
    }

    @SuppressWarnings("unchecked")
    public static  T get(String key) {
        return (T)PROPS.getProperty(key);
    }

    @SuppressWarnings("unchecked")
    public static  T get(String key, T defaultValue) {
        T res = (T) PROPS.get(key);
        if (res == null) {
            return defaultValue;
        }
        return res;
    }


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy