Class TigerConfigurationLoader
- java.lang.Object
-
- de.gematik.test.tiger.common.config.TigerConfigurationLoader
-
public class TigerConfigurationLoader extends Object
-
-
Constructor Summary
Constructors Constructor Description TigerConfigurationLoader()
-
Method Summary
-
-
-
Method Detail
-
reset
public void reset()
-
initialize
public void initialize()
-
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 beanbaseKeys- 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 beanbaseKeys- 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, SourceType sourceType, String... baseKeys)
-
readBoolean
public boolean readBoolean(String key)
-
readBoolean
public boolean readBoolean(String key, boolean defValue)
-
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)
-
listSources
public List<AbstractTigerConfigurationSource> listSources()
-
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()
-
-