public class BasicConfiguration extends Object implements Configuration
Constructor and Description |
---|
BasicConfiguration() |
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
Configuration.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()
The default configuration is stored in the file
sb4j.properties
or in the file defined by the system property named
sb4j.configuration . |
void |
setConfigProperties(Properties configProperties)
Configuration of the script engine is fed from standard Java properties.
|
void |
setFactory(Factory factory)
When a factory creates an instance of a class implementing this interface
this method is called to register the factory that created the instance.
|
public void setFactory(Factory factory)
FactoryManaged
setFactory
in interface FactoryManaged
factory
- the factory that manages the instance.public void setConfigProperties(Properties configProperties)
Configuration
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.
setConfigProperties
in interface Configuration
configProperties
- the configProperties to setpublic String getConfigValue(String key)
Configuration
getConfigValue
in interface Configuration
key
- the configuration key for which the value is looked up.null
if the key
is not configured.public String getConfigValue(String key, String defaultValue)
Configuration
Configuration.getConfigValue(String)
but returning
the defaultValue
instead of null
if the key
is
not configured.getConfigValue
in interface Configuration
key
- the configuration key, same as in Configuration.getConfigValue(String)
.defaultValue
- is the default value string to return if the configuration key
is not founddefaultValue
if
the key is not configured.public List<String> getConfigValueList(String key)
Configuration
key
'.n' where 'n' starts with zero and should
increment by one continuously.getConfigValueList
in interface Configuration
public void loadDefaultConfiguration()
sb4j.properties
or in the file defined by the system property named
sb4j.configuration
.loadDefaultConfiguration
in interface Configuration
Configuration.loadDefaultConfiguration()
public void loadConfiguration(InputStream is)
Configuration
loadConfiguration
in interface Configuration
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.