A hierarchical configuration. Such a configuration can have one or more
parent configurations providing usefull default values.
| Method from org.jfree.base.config.HierarchicalConfiguration Detail: |
public Object clone() throws CloneNotSupportedException {
HierarchicalConfiguration config = (HierarchicalConfiguration) super.clone();
config.configuration = (Properties) configuration.clone();
return config;
}
|
protected void configurationLoaded() {
}
A callback method to reconnect this configuration with the global
configuration after deserialization. |
public Iterator findPropertyKeys(String prefix) {
final TreeSet keys = new TreeSet();
collectPropertyKeys(prefix, this, keys);
return Collections.unmodifiableSet(keys).iterator();
}
Searches all property keys that start with a given prefix. |
public Enumeration getConfigProperties() {
return this.configuration.keys();
}
Returns all defined configuration properties for the report. The
enumeration contains all keys of the changed properties, properties set
from files or the system properties are not included. |
public String getConfigProperty(String key) {
return getConfigProperty(key, null);
}
Returns the configuration property with the specified key. |
public String getConfigProperty(String key,
String defaultValue) {
String value = this.configuration.getProperty(key);
if (value == null)
{
if (isRootConfig())
{
value = defaultValue;
}
else
{
value = this.parentConfiguration.getConfigProperty(key, defaultValue);
}
}
return value;
}
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. |
protected Properties getConfiguration() {
return this.configuration;
}
Returns the collection of properties for the configuration. |
protected Configuration getParentConfig() {
return this.parentConfiguration;
}
Returns the parent configuration. The parent configuration is queried, if
the requested configuration values was not found in this report
configuration. |
public void insertConfiguration(HierarchicalConfiguration config) {
config.setParentConfig(getParentConfig());
setParentConfig(config);
}
The new configuartion will be inserted into the list of report
configuration, so that this configuration has the given report
configuration instance as parent. |
public boolean isLocallyDefined(String key) {
return this.configuration.containsKey(key);
}
Checks, whether the given key is localy defined in this instance or
whether the key's value is inherited. |
protected boolean isParentSaved() {
return true;
}
Checks, whether the parent configuration can be serialized. Usually the
global configuration is not serialized and should return false here. |
public void setConfigProperty(String key,
String value) {
if (key == null)
{
throw new NullPointerException();
}
if (value == null)
{
this.configuration.remove(key);
}
else
{
this.configuration.setProperty(key, value);
}
}
Sets a configuration property. |
protected void setParentConfig(Configuration config) {
if (this.parentConfiguration == this)
{
throw new IllegalArgumentException("Cannot add myself as parent configuration.");
}
this.parentConfiguration = config;
}
Set the parent configuration. The parent configuration is queried, if the
requested configuration values was not found in this report
configuration. |