Package io.micronaut.core.util
Class EnvironmentProperties
- java.lang.Object
-
- io.micronaut.core.util.EnvironmentProperties
-
@Internal public final class EnvironmentProperties extends java.lang.Object
A mapping from environment variable names to Micronaut property names. Those can be precomputed, or computed on-the-fly when missing.- Since:
- 3.2.0
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Map<java.lang.String,java.util.List<java.lang.String>>
asMap()
Returns an immutable view of the environment variable names to Micronaut property names cache.static EnvironmentProperties
empty()
Creates a new empty cache of environment variable names to Micronaut properties cache.java.util.List<java.lang.String>
findPropertyNamesForEnvironmentVariable(java.lang.String env)
Returns, for an environment variable, the list of deduced Micronaut property names.static EnvironmentProperties
fork(EnvironmentProperties delegate)
Creates a new environment properties cache which delegates queries to the delegate, but will cache values into its own cache when they are missing.static EnvironmentProperties
of(java.util.Map<java.lang.String,java.util.List<java.lang.String>> preComputed)
Creates a new environment to property names cache with the supplied set of precomputed values.
-
-
-
Method Detail
-
of
public static EnvironmentProperties of(@NonNull java.util.Map<java.lang.String,java.util.List<java.lang.String>> preComputed)
Creates a new environment to property names cache with the supplied set of precomputed values.- Parameters:
preComputed
- a map from environment variable name to Micronaut property names- Returns:
- an environment properties cache
-
asMap
@NonNull public java.util.Map<java.lang.String,java.util.List<java.lang.String>> asMap()
Returns an immutable view of the environment variable names to Micronaut property names cache.- Returns:
- the current state of the cache
-
fork
public static EnvironmentProperties fork(EnvironmentProperties delegate)
Creates a new environment properties cache which delegates queries to the delegate, but will cache values into its own cache when they are missing.- Parameters:
delegate
- the delegate- Returns:
- a new environment properties cache
-
empty
public static EnvironmentProperties empty()
Creates a new empty cache of environment variable names to Micronaut properties cache.- Returns:
- an empty cache
-
findPropertyNamesForEnvironmentVariable
public java.util.List<java.lang.String> findPropertyNamesForEnvironmentVariable(java.lang.String env)
Returns, for an environment variable, the list of deduced Micronaut property names. The list is cached, so any further requests are guaranteed to return in constant time.- Parameters:
env
- the name of the environment variable- Returns:
- the list of deduced Micronaut property names
-
-