@Internal public class CachedEnvironment extends 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 Map<String,String> |
getenv()
Returns the complete set of environment variables.
|
static String |
getenv(String name)
Returns the value of the requested environment variable.
|
static String |
getProperty(String name)
Returns the system property of the requested name.
|
@Nullable public static String getenv(String name)
System.getenv(java.lang.String)
.name
- the name of the environment variable@NonNull public static Map<String,String> getenv()
System.getenv(java.lang.String)
.@Nullable public static String getProperty(String name)
System.getProperty(String)
.name
- the name of the system property