public class ConfigFinder extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
ConfigFinder.ConfigFinderBuilder |
| Modifier and Type | Field and Description |
|---|---|
protected Map<String,Object> |
configs |
protected org.slf4j.Logger |
logger |
protected Map<String,Object> |
rawConfigs |
| Modifier | Constructor and Description |
|---|---|
protected |
ConfigFinder(String classpathFilePath,
String externalFilePath,
List<String> environmentVariablesPrefixes,
boolean environmentVariablesStripPrefix,
List<String> systemPropertiesPrefixes,
boolean systemPropertiesStripPrefix,
boolean externalFileConfigsOverrideEnvironmentVariables,
boolean throwExceptionIfSpecifiedClasspathConfigFileIsNotFound,
boolean throwExceptionIfSpecifiedExternalConfigFileIsNotFound)
This component is not part of the Guice context because
you can very easily created circular dependencies with
configurations since they are used everywhere.
|
protected ConfigFinder(String classpathFilePath, String externalFilePath, List<String> environmentVariablesPrefixes, boolean environmentVariablesStripPrefix, List<String> systemPropertiesPrefixes, boolean systemPropertiesStripPrefix, boolean externalFileConfigsOverrideEnvironmentVariables, boolean throwExceptionIfSpecifiedClasspathConfigFileIsNotFound, boolean throwExceptionIfSpecifiedExternalConfigFileIsNotFound)
public static ConfigFinder.ConfigFinderBuilder configure()
protected String getClasspathFilePath()
protected String getExternalFilePath()
protected boolean isEnvironmentVariablesStripPrefix()
protected boolean isSystemPropertiesStripPrefix()
protected boolean isExternalFileConfigsOverrideEnvironmentVariables()
protected boolean isThrowExceptionIfSpecifiedClasspathConfigFileIsNotFound()
protected boolean isThrowExceptionIfSpecifiedExternalConfigFileIsNotFound()
protected void loadYamlFileConfigs(File configFile, org.yaml.snakeyaml.Yaml yaml)
protected Map<String,Object> expandMap(Map<String,Object> sourceMap)
protected Map<String,Object> mergeMaps(Map<String,Object> map1, Map<String,Object> map2)
public Object getRawConfig(String dottedKey)
public Object getConfigFromMap(Map<String,Object> map, String dottedKey)
null if not found.public Object getConfigFromMap(Map<String,Object> map, String dottedKey, Object defaultValue)
public Object getConfig(String key, Object defaultValue)
If the resulting config is null, the
default value will be returned.
public List<Map<String,Object>> getMapList(String key, List<Map<String,Object>> defaultValue)
protected BigDecimal getBigDecimalFromElement(Object val)
public BigDecimal getBigDecimal(String key)
public BigDecimal getBigDecimal(String key, BigDecimal defaultValue)
public List<BigDecimal> getBigDecimalList(String key)
public List<BigDecimal> getBigDecimalList(String key, List<BigDecimal> defaultValue)
protected File getAppJarDirectory()
null if the
application is not running from an executable .jar
file.protected File getAppRootDirectoryNoJar()
null if the
application is running from an executable .jar
file.Copyright © 2017. All rights reserved.