Class SimpleConfiguration
java.lang.Object
org.jpos.core.SimpleConfiguration
- All Implemented Interfaces:
Serializable, Configuration
A
Configuration implementation backed by a Properties object.- Since:
- jPOS 1.1
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.SimpleConfiguration(String filename) Loads a configuration from a Java.propertiesfile.SimpleConfiguration(Properties props) Wraps the suppliedPropertiesas a configuration. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the value of a configuration property.Returns the value of the configuration property namedname, or the default valuedef.String[]Returns all property values with the given name.booleangetBoolean(String name) Returns the value of a configuration property as a boolean.booleangetBoolean(String name, boolean def) Returns the value of a configuration property as a boolean, or a default.boolean[]getBooleans(String name) Returns all values of a configuration property as a boolean array.doubleReturns the value of a configuration property as a double.doubleReturns the value of a configuration property as a double, or a default.double[]getDoubles(String name) Returns all values of a configuration property as a double array.intReturns the value of a configuration property as an int.intReturns the value of a configuration property as an int, or a default.int[]Returns all values of a configuration property as an int array.longReturns the value of a configuration property as a long.longReturns the value of a configuration property as a long, or a default.long[]Returns all values of a configuration property as a long array.inthashCode()keySet()Returns the set of all property names in this configuration.voidLoads a Java.propertiesfile into this configuration.voidStores a property value.toString()
-
Constructor Details
-
SimpleConfiguration
public SimpleConfiguration()Default constructor. -
SimpleConfiguration
Wraps the suppliedPropertiesas a configuration.- Parameters:
props- backing properties (used by reference)
-
SimpleConfiguration
Loads a configuration from a Java.propertiesfile.- Parameters:
filename- path to the properties file- Throws:
IOException- if the file cannot be read
-
-
Method Details
-
get
Returns the value of the configuration property namedname, or the default valuedef. If the property value has the format${xxx}then its value is taken from a system property if it exists, or an environment variable. System property takes priority over environment variable. If the format is$sys{...}we read only a system property. if the format is$env{...}only an environment variable is used.- Specified by:
getin interfaceConfiguration- Parameters:
name- The configuration property key name.def- The default value.- Returns:
- The value stored under
name, ordefif there's no configuration property under the givenname.
-
getAll
Description copied from interface:ConfigurationReturns all property values with the given name.- Specified by:
getAllin interfaceConfiguration- Parameters:
name- the property name- Returns:
- all matching values, or a zero-length array
-
getInts
Description copied from interface:ConfigurationReturns all values of a configuration property as an int array.- Specified by:
getIntsin interfaceConfiguration- Parameters:
name- the property name- Returns:
- all values as int array
-
getLongs
Description copied from interface:ConfigurationReturns all values of a configuration property as a long array.- Specified by:
getLongsin interfaceConfiguration- Parameters:
name- the property name- Returns:
- all values as long array
-
getDoubles
Description copied from interface:ConfigurationReturns all values of a configuration property as a double array.- Specified by:
getDoublesin interfaceConfiguration- Parameters:
name- the property name- Returns:
- all values as double array
-
getBooleans
Description copied from interface:ConfigurationReturns all values of a configuration property as a boolean array.- Specified by:
getBooleansin interfaceConfiguration- Parameters:
name- the property name- Returns:
- all values as boolean array
-
get
Description copied from interface:ConfigurationReturns the value of a configuration property.- Specified by:
getin interfaceConfiguration- Parameters:
name- the property name- Returns:
- the property value, or an empty string if not found
-
getInt
Description copied from interface:ConfigurationReturns the value of a configuration property as an int.- Specified by:
getIntin interfaceConfiguration- Parameters:
name- the property name- Returns:
- the value as an int, or 0 if not found
-
getInt
Description copied from interface:ConfigurationReturns the value of a configuration property as an int, or a default.- Specified by:
getIntin interfaceConfiguration- Parameters:
name- the property namedef- default if not found- Returns:
- the value as an int
-
getLong
Description copied from interface:ConfigurationReturns the value of a configuration property as a long.- Specified by:
getLongin interfaceConfiguration- Parameters:
name- the property name- Returns:
- the value as a long, or 0 if not found
-
getLong
Description copied from interface:ConfigurationReturns the value of a configuration property as a long, or a default.- Specified by:
getLongin interfaceConfiguration- Parameters:
name- the property namedef- default if not found- Returns:
- the value as a long
-
getDouble
Description copied from interface:ConfigurationReturns the value of a configuration property as a double.- Specified by:
getDoublein interfaceConfiguration- Parameters:
name- the property name- Returns:
- the value as a double, or 0.0 if not found
-
getDouble
Description copied from interface:ConfigurationReturns the value of a configuration property as a double, or a default.- Specified by:
getDoublein interfaceConfiguration- Parameters:
name- the property namedef- default if not found- Returns:
- the value as a double
-
getBoolean
Description copied from interface:ConfigurationReturns the value of a configuration property as a boolean.- Specified by:
getBooleanin interfaceConfiguration- Parameters:
name- the property name- Returns:
- the value as a boolean, or false if not found
-
getBoolean
Description copied from interface:ConfigurationReturns the value of a configuration property as a boolean, or a default.- Specified by:
getBooleanin interfaceConfiguration- Parameters:
name- the property namedef- default if not found- Returns:
- the value as a boolean
-
load
Loads a Java.propertiesfile into this configuration.- Parameters:
filename- path to the properties file- Throws:
IOException- if the file cannot be read
-
put
Description copied from interface:ConfigurationStores a property value.- Specified by:
putin interfaceConfiguration- Parameters:
name- the property namevalue- the value (typically a String or String[])
-
keySet
Description copied from interface:ConfigurationReturns the set of all property names in this configuration.- Specified by:
keySetin interfaceConfiguration- Returns:
- the property name set
-
equals
-
hashCode
-
toString
-