@Internal public class CachedEnvironment extends java.lang.Object
System.getenv()
or System.getProperties()
.
The API is therefore a mirror to the equivalent System
class calls,
except that if "environment caching" is enabled, then all system properties
and all environment variables are deemed immutable: they will be queried at
application startup once and cached forever.
By default, caching is disabled. Should you want to have caching enabled,
you must make sure that a call to StaticOptimizations.cacheEnvironment()
is made prior to initializing this class.Constructor and Description |
---|
CachedEnvironment() |
Modifier and Type | Method and Description |
---|---|
static java.util.Map<java.lang.String,java.lang.String> |
getenv()
Returns the complete set of environment variables.
|
static java.lang.String |
getenv(java.lang.String name)
Returns the value of the requested environment variable.
|
static java.lang.String |
getProperty(java.lang.String name)
Returns the system property of the requested name.
|
@Nullable public static java.lang.String getenv(java.lang.String name)
System.getenv(java.lang.String)
.name
- the name of the environment variable@NonNull public static java.util.Map<java.lang.String,java.lang.String> getenv()
System.getenv(java.lang.String)
.@Nullable public static java.lang.String getProperty(java.lang.String name)
System.getProperty(String)
.name
- the name of the system property