public class PropertiesAccessor extends Object
| Constructor and Description |
|---|
PropertiesAccessor(Properties p) |
PropertiesAccessor(Properties p,
boolean letSystemPropertiesOverride,
Map<String,String> stringReplacements)
Initialise the properties accessor.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
getBoolean(String property)
Get a boolean property from the underlying properties.
|
boolean |
getBoolean(String property,
boolean defaultValue)
Get a boolean property from the underlying properties.
|
double |
getDouble(String property)
Get a double property from the underlying properties.
|
double |
getDouble(String property,
double defaultValue)
Get a property from the underlying properties.
|
int |
getInteger(String property)
Get an integer property from the underlying properties.
|
int |
getInteger(String property,
int defaultValue)
Get a property from the underlying properties.
|
String |
getProperty(String key)
Get a property from the underlying properties.
|
String |
getProperty(String key,
String defaultValue)
Get a property from the underlying properties.
|
InputStream |
getStream(String propertyName)
For the named property, attempt to get an open input stream.
|
public PropertiesAccessor(Properties p)
public PropertiesAccessor(Properties p, boolean letSystemPropertiesOverride, Map<String,String> stringReplacements)
p - the properties to accessletSystemPropertiesOverride - if true, any property will first be looked up in the system properties; only if it is not found there, it will
be looked up in pstringReplacements - before → after pairs of string replacements to perform before returning any property values.public String getProperty(String key)
key - the property key requestedpublic String getProperty(String key, String defaultValue)
key - the property key requesteddefaultValue - the value to return if the property is not definedpublic boolean getBoolean(String property)
property - the property requestedpublic boolean getBoolean(String property, boolean defaultValue)
property - the property requesteddefaultValue - the value to return if the property is not definedpublic int getInteger(String property)
property - the property requestedpublic int getInteger(String property, int defaultValue)
property - the property requesteddefaultValue - the value to return if the property is not definedpublic double getDouble(String property)
property - the property requestedpublic double getDouble(String property, double defaultValue)
property - the property requesteddefaultValue - the value to return if the property is not definedpublic InputStream getStream(String propertyName) throws FileNotFoundException, MaryConfigurationException
propertyName - the name of a property defined in one of the mary config files.FileNotFoundException - if the property value is a file name and the file cannot be openedMaryConfigurationException - if the property value is a classpath entry which cannot be openedCopyright © 2000–2016 DFKI GmbH. All rights reserved.