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

io.polaris.core.env.SystemEnvWrapper Maven / Gradle / Ivy

There is a newer version: 3.2.1
Show newest version
package io.polaris.core.env;

import java.util.Set;

/**
 * @author Qt
 * @since 1.8,  Apr 23, 2024
 */
class SystemEnvWrapper implements Env {

	private final String name;

	public SystemEnvWrapper(String name) {
		this.name = name;
	}

	@Override
	public String name() {
		return name;
	}


	@Override
	public void set(String key, String value) {
	}

	@Override
	public String get(String key) {
		String val = System.getenv(key);
		if (val == null) {
			String envKey = key.replace(".", "_").toUpperCase();
			val = System.getenv(envKey);
		}
		return val;
	}

	@Override
	public void remove(String key) {
	}

	@Override
	public Set keys() {
		return System.getenv().keySet();
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy