public interface Configuration extends FactoryManaged
When requesting individual configuration keys the implementation can look for the values in different sources. Typical implementation will look up values in the system properties and environment first before searching the configuration properties.
Modifier and Type | Method and Description |
---|---|
String |
getConfigValue(String key)
Get the value of the key.
|
String |
getConfigValue(String key,
String defaultValue)
Complimentary method calling
getConfigValue(String) but returning
the defaultValue instead of null if the key is
not configured. |
List<String> |
getConfigValueList(String key)
Returns a list of strings that are the values assigned to the key in the
configuration.
|
void |
loadConfiguration(InputStream is)
Load the configuration from an input stream.
|
void |
loadDefaultConfiguration()
Load the default configuration.
|
void |
setConfigProperties(Properties configProperties)
Configuration of the script engine is fed from standard Java properties.
|
setFactory
void setConfigProperties(Properties configProperties)
The fact that all other, possibly already loaded properties are not taken into account does not affect the fact that the configuration implementation itself may search other sources in addition to the properties to locate values for certain configuration keys.
configProperties
- the properties to be used as configuration properties.String getConfigValue(String key)
key
- the configuration key for which the value is looked up.null
if the key
is not configured.String getConfigValue(String key, String defaultValue)
getConfigValue(String)
but returning
the defaultValue
instead of null
if the key
is
not configured.key
- the configuration key, same as in getConfigValue(String)
.defaultValue
- is the default value string to return if the configuration key
is not founddefaultValue
if
the key is not configured.List<String> getConfigValueList(String key)
key
'.n' where 'n' starts with zero and should
increment by one continuously.key
- void loadDefaultConfiguration()
void loadConfiguration(InputStream is)
is
- the input stream that is used to read the content of the
properties file.Copyright © 2013 Verhas and Verhas Software Craftsmen. All Rights Reserved.