Package org.jpos.core
Class SubConfiguration
- java.lang.Object
-
- org.jpos.core.SubConfiguration
-
- All Implemented Interfaces:
Configuration
public class SubConfiguration extends java.lang.Object implements 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
Fields Modifier and Type Field Description protected Configuration
cfg
Parent Configurationprotected java.lang.String
prefix
prefix identifying the child parameters
-
Constructor Summary
Constructors Constructor Description SubConfiguration()
Creates a new empty SubConfiguration objectSubConfiguration(Configuration cfg, java.lang.String prefix)
Creates a new SubConfiguration from its parent's Configuration and the a givenprefix
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
get(java.lang.String propertyName)
java.lang.String
get(java.lang.String propertyName, java.lang.String defaultValue)
java.lang.String[]
getAll(java.lang.String propertyName)
boolean
getBoolean(java.lang.String propertyName)
boolean
getBoolean(java.lang.String propertyName, boolean defaultValue)
boolean[]
getBooleans(java.lang.String propertyName)
double
getDouble(java.lang.String propertyName)
double
getDouble(java.lang.String propertyName, double defaultValue)
double[]
getDoubles(java.lang.String propertyName)
int
getInt(java.lang.String propertyName)
int
getInt(java.lang.String propertyName, int defaultValue)
int[]
getInts(java.lang.String propertyName)
long
getLong(java.lang.String propertyName)
long
getLong(java.lang.String propertyName, long defaultValue)
long[]
getLongs(java.lang.String propertyName)
java.lang.Object
getObject(java.lang.String propertyName)
Creates a new object, it takes the class from the value of the propertypropertyName
java.util.Set<java.lang.String>
keySet()
void
put(java.lang.String name, java.lang.Object value)
void
setConfiguration(Configuration newCfg)
Sets the container configuration.void
setPrefix(java.lang.String newPrefix)
Sets the prefix that identifies the parameters of the child object inside the parent configuration.
-
-
-
Field Detail
-
cfg
protected Configuration cfg
Parent Configuration
-
prefix
protected java.lang.String prefix
prefix identifying the child parameters
-
-
Constructor Detail
-
SubConfiguration
public SubConfiguration()
Creates a new empty SubConfiguration object
-
SubConfiguration
public SubConfiguration(Configuration cfg, java.lang.String prefix)
Creates a new SubConfiguration from its parent's Configuration and the a givenprefix
.- Parameters:
cfg
- Parent's Configurationprefix
- prefix identifying child parameters.
-
-
Method Detail
-
setConfiguration
public void setConfiguration(Configuration newCfg)
Sets the container configuration.- Parameters:
newCfg
- New container configuration.
-
setPrefix
public void setPrefix(java.lang.String newPrefix)
Sets the prefix that identifies the parameters of the child object inside the parent configuration.- Parameters:
newPrefix
- New prefix
-
get
public java.lang.String get(java.lang.String propertyName)
- Specified by:
get
in interfaceConfiguration
-
getAll
public java.lang.String[] getAll(java.lang.String propertyName)
- Specified by:
getAll
in interfaceConfiguration
- Parameters:
propertyName
- ditto- Returns:
- all properties with a given name (or a zero-length array)
-
getInts
public int[] getInts(java.lang.String propertyName)
- Specified by:
getInts
in interfaceConfiguration
-
getLongs
public long[] getLongs(java.lang.String propertyName)
- Specified by:
getLongs
in interfaceConfiguration
-
getDoubles
public double[] getDoubles(java.lang.String propertyName)
- Specified by:
getDoubles
in interfaceConfiguration
-
getBooleans
public boolean[] getBooleans(java.lang.String propertyName)
- Specified by:
getBooleans
in interfaceConfiguration
-
get
public java.lang.String get(java.lang.String propertyName, java.lang.String defaultValue)
- Specified by:
get
in interfaceConfiguration
-
getBoolean
public boolean getBoolean(java.lang.String propertyName)
- Specified by:
getBoolean
in interfaceConfiguration
-
getBoolean
public boolean getBoolean(java.lang.String propertyName, boolean defaultValue)
- Specified by:
getBoolean
in interfaceConfiguration
-
getDouble
public double getDouble(java.lang.String propertyName)
- Specified by:
getDouble
in interfaceConfiguration
-
getDouble
public double getDouble(java.lang.String propertyName, double defaultValue)
- Specified by:
getDouble
in interfaceConfiguration
-
getLong
public long getLong(java.lang.String propertyName)
- Specified by:
getLong
in interfaceConfiguration
-
getLong
public long getLong(java.lang.String propertyName, long defaultValue)
- Specified by:
getLong
in interfaceConfiguration
-
getInt
public int getInt(java.lang.String propertyName)
- Specified by:
getInt
in interfaceConfiguration
-
getInt
public int getInt(java.lang.String propertyName, int defaultValue)
- Specified by:
getInt
in interfaceConfiguration
-
put
public void put(java.lang.String name, java.lang.Object value)
- Specified by:
put
in interfaceConfiguration
- Parameters:
name
- the Property namevalue
- typically a String, but could be a String[] too
-
getObject
public java.lang.Object getObject(java.lang.String propertyName) throws ConfigurationException
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.- Throws:
ConfigurationException
-
keySet
public java.util.Set<java.lang.String> keySet()
- Specified by:
keySet
in interfaceConfiguration
-
-