Class EnvironmentProperties

java.lang.Object
io.micronaut.core.util.EnvironmentProperties

@Internal public final class EnvironmentProperties extends 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 Details

    • of

      public static EnvironmentProperties of(@NonNull Map<String,List<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 Map<String,List<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 List<String> findPropertyNamesForEnvironmentVariable(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