Class SubConfiguration
java.lang.Object
org.jpos.core.SubConfiguration
- All Implemented Interfaces:
Configuration
SubConfiguration objects lets childs objects access attributes
in its parent object with a given prefix, for example "child.".
Child objects can access properties with their prefix removed.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ConfigurationParent Configurationprotected Stringprefix identifying the child parameters -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new empty SubConfiguration objectSubConfiguration(Configuration cfg, String prefix) Creates a new SubConfiguration from its parent's Configuration and the a givenprefix. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of a configuration property.Returns the value of a configuration property, or a default.String[]Returns all property values with the given name.booleangetBoolean(String propertyName) Returns the value of a configuration property as a boolean.booleangetBoolean(String propertyName, boolean defaultValue) Returns the value of a configuration property as a boolean, or a default.boolean[]getBooleans(String propertyName) 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 propertyName) 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.Creates a new object, it takes the class from the value of the propertypropertyNamekeySet()Returns the set of all property names in this configuration.voidStores a property value.voidsetConfiguration(Configuration newCfg) Sets the container configuration.voidSets the prefix that identifies the parameters of the child object inside the parent configuration.
-
Field Details
-
cfg
Parent Configuration -
prefix
-
-
Constructor Details
-
SubConfiguration
public SubConfiguration()Creates a new empty SubConfiguration object -
SubConfiguration
Creates a new SubConfiguration from its parent's Configuration and the a givenprefix.- Parameters:
cfg- Parent's Configurationprefix- prefix identifying child parameters.
-
-
Method Details
-
setConfiguration
Sets the container configuration.- Parameters:
newCfg- New container configuration.
-
setPrefix
-
get
Description copied from interface:ConfigurationReturns the value of a configuration property.- Specified by:
getin interfaceConfiguration- Parameters:
propertyName- the property name- Returns:
- the property value, or an empty string if not found
-
getAll
Description copied from interface:ConfigurationReturns all property values with the given name.- Specified by:
getAllin interfaceConfiguration- Parameters:
propertyName- 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:
propertyName- 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:
propertyName- 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:
propertyName- 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:
propertyName- the property name- Returns:
- all values as boolean array
-
get
Description copied from interface:ConfigurationReturns the value of a configuration property, or a default.- Specified by:
getin interfaceConfiguration- Parameters:
propertyName- the property namedefaultValue- value to return if not found- Returns:
- the property value or
defaultValue
-
getBoolean
Description copied from interface:ConfigurationReturns the value of a configuration property as a boolean.- Specified by:
getBooleanin interfaceConfiguration- Parameters:
propertyName- 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:
propertyName- the property namedefaultValue- default if not found- Returns:
- the value as a boolean
-
getDouble
Description copied from interface:ConfigurationReturns the value of a configuration property as a double.- Specified by:
getDoublein interfaceConfiguration- Parameters:
propertyName- 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:
propertyName- the property namedefaultValue- default if not found- Returns:
- the value as a double
-
getLong
Description copied from interface:ConfigurationReturns the value of a configuration property as a long.- Specified by:
getLongin interfaceConfiguration- Parameters:
propertyName- 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:
propertyName- the property namedefaultValue- default if not found- Returns:
- the value as a long
-
getInt
Description copied from interface:ConfigurationReturns the value of a configuration property as an int.- Specified by:
getIntin interfaceConfiguration- Parameters:
propertyName- 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:
propertyName- the property namedefaultValue- default if not found- Returns:
- the value as an int
-
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[])
-
getObject
Creates a new object, it takes the class from the value of the propertypropertyName- Parameters:
propertyName- Property whose value is the class name of the object being created.- Returns:
- the instantiated (and optionally configured) object
- Throws:
ConfigurationException- if the class cannot be resolved or instantiated
-
keySet
Description copied from interface:ConfigurationReturns the set of all property names in this configuration.- Specified by:
keySetin interfaceConfiguration- Returns:
- the property name set
-