Class TigerConfigurationLoader

java.lang.Object
de.gematik.test.tiger.common.config.TigerConfigurationLoader

public class TigerConfigurationLoader extends Object
  • Constructor Details

    • TigerConfigurationLoader

      public TigerConfigurationLoader()
  • Method Details

    • reset

      public void reset()
    • initialize

      public void initialize()
    • readString

      public String readString(String key)
    • readString

      public String readString(String key, String defaultValue)
    • readStringOptional

      public Optional<String> readStringOptional(String key)
    • readStringOptional

      public Optional<String> readStringOptional(TigerConfigurationKey key)
    • instantiateConfigurationBean

      public <T> Optional<T> instantiateConfigurationBean(Class<T> configurationBeanClass, String... baseKeys)
      Instantiates a bean of the given class. The base-keys denote the point from which the keys are taken. If values can not be substituted (e.g. ${key.that.does.not.exist}) they are simply returned as a string. This behaviour is more relaxed towards input errors but might delay failures from startup to runtime.

      If the base-keys lead to a non-defined (i.e. empty) node in the tree (no values have been read) an empty optional is returned.

      Type Parameters:
      T -
      Parameters:
      configurationBeanClass - The class of the configuration bean
      baseKeys - Where in the configuration tree should the values be taken from?
      Returns:
      An instance of configurationBeanClass filled with values taken from the configuration tree
    • instantiateConfigurationBeanStrict

      public <T> Optional<T> instantiateConfigurationBeanStrict(Class<T> configurationBeanClass, String... baseKeys)
      Instantiates a bean of the given class. The base-keys denote the point from which the keys are taken. If values can not be substituted (e.g. ${key.that.does.not.exist}) an empty value is returned. This behaviour follows the "fail fast, fail early" approach.

      If the base-keys lead to a non-defined (i.e. empty) node in the tree (no values have been read) an empty optional is returned.

      Type Parameters:
      T -
      Parameters:
      configurationBeanClass - The class of the configuration bean
      baseKeys - Where in the configuration tree should the values be taken from?
      Returns:
      An instance of configurationBeanClass filled with values taken from the configuration tree
    • instantiateConfigurationBean

      public <T> T instantiateConfigurationBean(com.fasterxml.jackson.core.type.TypeReference<T> configurationBeanType, String... baseKeys)
    • readFromYaml

      public void readFromYaml(String yamlSource, String... baseKeys)
    • readFromYaml

      public void readFromYaml(String yamlSource, SourceType sourceType, String... baseKeys)
    • readBoolean

      public boolean readBoolean(String key)
    • readBoolean

      public boolean readBoolean(String key, boolean defValue)
    • readBooleanOptional

      public Optional<Boolean> readBooleanOptional(String key)
    • readTemplates

      public void readTemplates(String templatesYaml, String... baseKeys)
    • loadEnvironmentVariables

      public void loadEnvironmentVariables()
    • loadSystemProperties

      public void loadSystemProperties()
    • retrieveMap

      public Map<TigerConfigurationKey,String> retrieveMap()
    • addYamlToMap

      public static Map<TigerConfigurationKey,String> addYamlToMap(Object value, TigerConfigurationKey baseKeys, Map<TigerConfigurationKey,String> valueMap)
    • readMap

      public Map<String,String> readMap(String... baseKeys)
    • readMapWithCaseSensitiveKeys

      public Map<String,String> readMapWithCaseSensitiveKeys(String... baseKeys)
    • listSources

      public List<AbstractTigerConfigurationSource> listSources()
    • putValue

      public void putValue(String key, String value)
    • putValue

      public void putValue(String key, Object value)
    • putValue

      public void putValue(String key, String value, SourceType sourceType)
    • addConfigurationSource

      public void addConfigurationSource(AbstractTigerConfigurationSource configurationSource)
    • removeConfigurationSource

      public boolean removeConfigurationSource(AbstractTigerConfigurationSource configurationSource)
    • getObjectMapper

      public com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()