Class Configuration

java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap<K,V>
java.util.LinkedHashMap<String,Object>
io.micronaut.projectgen.core.feature.config.Configuration
All Implemented Interfaces:
Serializable, Cloneable, Map<String,Object>
Direct Known Subclasses:
ApplicationConfiguration, BootstrapConfiguration

public class Configuration extends LinkedHashMap<String,Object>
Models application environment configuration to specify where the configuration is rooted for the given configuration values (key/value pairs).
See Also:
  • Field Details

  • Constructor Details

    • Configuration

      public Configuration(@NonNull @NonNull String sourceSet, @NonNull @NonNull String fileName, @NonNull @NonNull String templateKey)
      A configuration rooted at path, with the given map of configurations.
      Parameters:
      sourceSet - where the configuration is rooted, e.g. main, test
      fileName - Filename
      templateKey - Template Key
  • Method Details

    • containsKey

      public boolean containsKey(Object key)
      Specified by:
      containsKey in interface Map<String,Object>
      Overrides:
      containsKey in class HashMap<String,Object>
    • get

      public Object get(Object key)
      Specified by:
      get in interface Map<String,Object>
      Overrides:
      get in class LinkedHashMap<String,Object>
    • addNested

      public Configuration addNested(String path, Object value)
      Add a nested value for the given path.
      Parameters:
      path - The path
      value - The value
      Returns:
      this configuration
    • addNested

      public Configuration addNested(NestedConfiguration nestedConfiguration)
      Adds nested configuration.
      Parameters:
      nestedConfiguration - Nested Configuration
      Returns:
      this configuration
    • addNested

      public Configuration addNested(Map<String,Object> values)
      Add nested values for the given path.
      Parameters:
      values - A map of path to value entries
      Returns:
      this configuration
    • getPath

      @NonNull public @NonNull String getPath()
      Returns:
      path
    • getFileName

      @NonNull public @NonNull String getFileName()
      Returns:
      filename
    • getFullPath

      @NonNull public @NonNull String getFullPath(String extension)
      Parameters:
      extension - extension
      Returns:
      full path
    • getTemplateKey

      @NonNull public @NonNull String getTemplateKey()
      Returns:
      template key
    • equals

      public boolean equals(Object o)
      Specified by:
      equals in interface Map<String,Object>
      Overrides:
      equals in class AbstractMap<String,Object>
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in interface Map<String,Object>
      Overrides:
      hashCode in class AbstractMap<String,Object>
    • addCommaSeparatedValue

      public void addCommaSeparatedValue(String key, String value)
      Parameters:
      key - key
      value - value
    • addListItem

      public void addListItem(String key, String value)
      Parameters:
      key - key
      value - value
    • comment

      public void comment(String comment)
      Parameters:
      comment - a comment to a configuration file.
    • blankLine

      public void blankLine()
      Add a blank line