public class EnvUtils
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static java.util.Optional<java.lang.String> |
getEnvVar(Environment environment,
java.lang.String key)
Returns the value of the provided environment variable, or an empty
Optional if no matching environment
variable was found. |
static java.lang.String |
toEnvName(java.lang.String str)
Converts the provided string to a conventional environment variable name, consisting of numbers, uppercase
letters, and underscores.
|
static java.util.Map<java.lang.String,java.lang.String> |
toMap(Environment environment)
Returns a Map representation of the provided
Environment. |
static Environment |
toProto(java.util.Map<java.lang.String,java.lang.String> environmentMap)
Returns a Protobuf representation of the provided environment
Map. |
static Environment |
withEnvVar(Environment environment,
java.lang.String key,
java.lang.String value)
Adds or updates the provided environment variable entry in the provided command builder.
|
public static java.util.Map<java.lang.String,java.lang.String> toMap(Environment environment)
Environment.
In the event of duplicate labels, the last duplicate wins.
This is the inverse of toProto(Map).public static Environment toProto(java.util.Map<java.lang.String,java.lang.String> environmentMap)
Map.
This is the inverse of toMap(Environment).public static Environment withEnvVar(Environment environment,
java.lang.String key,
java.lang.String value)
public static java.util.Optional<java.lang.String> getEnvVar(Environment environment,
java.lang.String key)
Optional if no matching environment
variable was found.public static java.lang.String toEnvName(java.lang.String str)
hello.There999! => HELLO_THERE999_