Class TigerConfigurationLoader
java.lang.Object
de.gematik.test.tiger.common.config.TigerConfigurationLoader
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddConfigurationSource(AbstractTigerConfigurationSource configurationSource) static Map<TigerConfigurationKey,String> addYamlToMap(Object value, TigerConfigurationKey baseKeys, Map<TigerConfigurationKey, String> valueMap) com.fasterxml.jackson.databind.ObjectMappervoid<T> TinstantiateConfigurationBean(com.fasterxml.jackson.core.type.TypeReference<T> configurationBeanType, String... baseKeys) <T> Optional<T>instantiateConfigurationBean(Class<T> configurationBeanClass, String... baseKeys) Instantiates a bean of the given class.<T> Optional<T>instantiateConfigurationBeanStrict(Class<T> configurationBeanClass, String... baseKeys) Instantiates a bean of the given class.voidvoidvoidputValue(TigerConfigurationKey key, Object value, SourceType sourceType) voidvoidputValue(String key, Object value, SourceType sourceType) booleanreadBoolean(String key) booleanreadBoolean(String key, boolean defValue) voidreadFromYaml(String yamlSource, SourceType sourceType, String... baseKeys) voidreadFromYaml(String yamlSource, String... baseKeys) readMapWithCaseSensitiveKeys(String... baseKeys) readString(String key) readString(String key, String defaultValue) readStringOptional(String key) voidreadTemplates(String templatesYaml, String... baseKeys) booleanremoveConfigurationSource(AbstractTigerConfigurationSource configurationSource) voidreset()retrieveMap(TigerConfigurationKey reference) Generates a map containing all key/value pairs.Generates a map containing all key/value pairs.
-
Field Details
-
TIGER_CONFIGURATION_ATTRIBUTE_KEY
- See Also:
-
-
Constructor Details
-
TigerConfigurationLoader
public TigerConfigurationLoader()
-
-
Method Details
-
addYamlToMap
public static Map<TigerConfigurationKey,String> addYamlToMap(Object value, TigerConfigurationKey baseKeys, Map<TigerConfigurationKey, String> valueMap) -
reset
public void reset() -
initialize
public void initialize() -
readString
-
readString
-
readStringOptional
-
readStringOptional
-
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.
- 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.
- 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
-
readFromYaml
-
readBoolean
-
readBoolean
-
readBooleanOptional
-
readTemplates
-
loadEnvironmentVariables
public void loadEnvironmentVariables() -
loadSystemProperties
public void loadSystemProperties() -
retrieveMap
Generates a map containing all key/value pairs. All placeholders below the reference in the values are resolved. -
retrieveMapUnresolved
Generates a map containing all key/value pairs. Placeholders in the values are NOT resolved. -
readMap
-
readList
-
readMapWithCaseSensitiveKeys
-
readMapWithCaseSensitiveKeys
-
listSources
-
putValue
-
putValue
-
putValue
-
addConfigurationSource
-
removeConfigurationSource
-
getObjectMapper
public com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()
-