Class ExtendedConfigurationWrapper
- java.lang.Object
-
- org.pentaho.reporting.libraries.base.config.ExtendedConfigurationWrapper
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Configuration
,ExtendedConfiguration
public class ExtendedConfigurationWrapper extends Object implements ExtendedConfiguration
A wrapper for the extended configuration interface around a plain configuration.- Author:
- Thomas Morgner
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ExtendedConfigurationWrapper(Configuration parent)
Creates a wrapper around the given configuration.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
clone()
Returns a clone of the object.Iterator<String>
findPropertyKeys(String prefix)
Returns all keys with the given prefix.boolean
getBoolProperty(String name)
Returns the boolean value of a given configuration property.boolean
getBoolProperty(String name, boolean defaultValue)
Returns the boolean value of a given configuration property.Enumeration<String>
getConfigProperties()
Returns the configuration properties.String
getConfigProperty(String key)
Returns the configuration property with the specified key.String
getConfigProperty(String key, String defaultValue)
Returns the configuration property with the specified key (or the specified default value if there is no such property).int
getIntProperty(String name)
Returns a given property as int value.int
getIntProperty(String name, int defaultValue)
Returns a given property as int value.boolean
isPropertySet(String name)
Checks, whether a given property is defined.
-
-
-
Constructor Detail
-
ExtendedConfigurationWrapper
public ExtendedConfigurationWrapper(Configuration parent)
Creates a wrapper around the given configuration.- Parameters:
parent
- the wrapped up configuration.- Throws:
NullPointerException
- if the parent is null.
-
-
Method Detail
-
getBoolProperty
public boolean getBoolProperty(String name)
Returns the boolean value of a given configuration property. The boolean value true is returned, if the contained string is equal to 'true'.- Specified by:
getBoolProperty
in interfaceExtendedConfiguration
- Parameters:
name
- the name of the property- Returns:
- the boolean value of the property.
-
getBoolProperty
public boolean getBoolProperty(String name, boolean defaultValue)
Returns the boolean value of a given configuration property. The boolean value true is returned, if the contained string is equal to 'true'. If the property is not set, the default value is returned.- Specified by:
getBoolProperty
in interfaceExtendedConfiguration
- Parameters:
name
- the name of the propertydefaultValue
- the default value to be returned if the property is not set- Returns:
- the boolean value of the property.
-
getIntProperty
public int getIntProperty(String name)
Returns a given property as int value. Zero is returned if the property value is no number or the property is not set.- Specified by:
getIntProperty
in interfaceExtendedConfiguration
- Parameters:
name
- the name of the property- Returns:
- the parsed number value or zero
-
getIntProperty
public int getIntProperty(String name, int defaultValue)
Returns a given property as int value. The specified default value is returned if the property value is no number or the property is not set.- Specified by:
getIntProperty
in interfaceExtendedConfiguration
- Parameters:
name
- the name of the propertydefaultValue
- the value to be returned if the property is no integer value- Returns:
- the parsed number value or the specified default value
-
isPropertySet
public boolean isPropertySet(String name)
Checks, whether a given property is defined.- Specified by:
isPropertySet
in interfaceExtendedConfiguration
- Parameters:
name
- the name of the property- Returns:
- true, if the property is defined, false otherwise.
-
findPropertyKeys
public Iterator<String> findPropertyKeys(String prefix)
Returns all keys with the given prefix.- Specified by:
findPropertyKeys
in interfaceConfiguration
- Parameters:
prefix
- the prefix- Returns:
- the iterator containing all keys with that prefix
-
getConfigProperty
public String getConfigProperty(String key)
Returns the configuration property with the specified key.- Specified by:
getConfigProperty
in interfaceConfiguration
- Parameters:
key
- the property key.- Returns:
- the property value.
-
getConfigProperty
public String getConfigProperty(String key, String defaultValue)
Returns the configuration property with the specified key (or the specified default value if there is no such property). If the property is not defined in this configuration, the code will lookup the property in the parent configuration.- Specified by:
getConfigProperty
in interfaceConfiguration
- Parameters:
key
- the property key.defaultValue
- the default value.- Returns:
- the property value.
-
getConfigProperties
public Enumeration<String> getConfigProperties()
Description copied from interface:Configuration
Returns the configuration properties.- Specified by:
getConfigProperties
in interfaceConfiguration
- Returns:
- The configuration properties.
-
clone
public Object clone() throws CloneNotSupportedException
Description copied from interface:Configuration
Returns a clone of the object.- Specified by:
clone
in interfaceConfiguration
- Overrides:
clone
in classObject
- Returns:
- A clone.
- Throws:
CloneNotSupportedException
- if cloning is not supported for some reason.
-
-