@Typed public final class ConfigResolver extends Object
Resolve the configuration via their well defined ordinals.
You can provide your own lookup paths by implementing
and registering additional PropertyFileConfig or
ConfigSource or ConfigSourceProvider implementations.
| Modifier and Type | Method and Description |
|---|---|
static void |
addConfigSources(List<ConfigSource> configSourcesToAdd)
This method can be used for programmatically adding
ConfigSources. |
static void |
freeConfigSources()
Clear all ConfigSources for the current ClassLoader
|
static Map<String,String> |
getAllProperties() |
static List<String> |
getAllPropertyValues(String key)
Resolve all values for the given key, from all registered ConfigSources ordered by their
ordinal value in ascending ways.
|
static String |
getPropertyValue(String key)
Resolve the property value by going through the list of configured
ConfigSources
and use the one with the highest priority. |
static String |
getPropertyValue(String key,
String defaultValue)
Resolve the property value by going through the list of configured
ConfigSources
and use the one with the highest priority. |
public static void addConfigSources(List<ConfigSource> configSourcesToAdd)
ConfigSources.
It is not needed for normal 'usage' by end users, but only for Extension Developers!configSourcesToAdd - the ConfigSources to addpublic static void freeConfigSources()
public static String getPropertyValue(String key, String defaultValue)
ConfigSources
and use the one with the highest priority. If no configured value has been found that
way we will use the defaultValue.key - the property key.defaultValue - will be used if no configured value for the key could be found.ConfigSource with the highest ordinal or
the defaultValue if there is no value explicitly configured.public static String getPropertyValue(String key)
ConfigSources
and use the one with the highest priority.key - the property key.ConfigSource with the highest ordinal or
null if there is no configured value for it.public static List<String> getAllPropertyValues(String key)
ConfigSources have the same ordinal, their
order is undefined.key - under which configuration is storedConfigSource.getOrdinal()Copyright © 2011-2013 The Apache Software Foundation. All Rights Reserved.