Home / Class/ EnvVariables Class — spring-boot Architecture

EnvVariables Class — spring-boot Architecture

Architecture documentation for the EnvVariables class in EnvVariables.java from the spring-boot codebase.

Entity Profile

Source Code

build-plugin/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/EnvVariables.java lines 32–69

class EnvVariables {

	private final Map<String, String> variables;

	EnvVariables(@Nullable Map<String, String> variables) {
		this.variables = parseEnvVariables(variables);
	}

	private static Map<String, String> parseEnvVariables(@Nullable Map<String, String> args) {
		if (args == null || args.isEmpty()) {
			return Collections.emptyMap();
		}
		Map<String, String> result = new LinkedHashMap<>();
		for (Map.Entry<String, String> e : args.entrySet()) {
			if (e.getKey() != null) {
				result.put(e.getKey(), getValue(e.getValue()));
			}
		}
		return result;
	}

	private static String getValue(@Nullable String value) {
		return (value != null) ? value : "";
	}

	Map<String, String> asMap() {
		return Collections.unmodifiableMap(this.variables);
	}

	String[] asArray() {
		List<String> args = new ArrayList<>(this.variables.size());
		for (Map.Entry<String, String> arg : this.variables.entrySet()) {
			args.add(arg.getKey() + "=" + arg.getValue());
		}
		return args.toArray(new String[0]);
	}

}

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free