org.jconfig
Class ExtensibleConfiguration
java.lang.Object
org.jconfig.DefaultConfiguration
org.jconfig.ExtensibleConfiguration
- All Implemented Interfaces:
- Configuration, java.io.Serializable
- public class ExtensibleConfiguration
- extends DefaultConfiguration
- implements java.io.Serializable
This class is the configuration itself. The Configuration is
useful if one wants to manage multiple configurations. A single
instance of the Configuration may contain, for example, information
for one application or user.
- Author:
- Andreas Mecky andreas.mecky@xcom.de, Terry Dye terry.dye@xcom.de
- See Also:
- Serialized Form
Constructor Summary |
ExtensibleConfiguration(java.lang.String configName)
The constructor that creates a new configuration
with one empty category called "general". |
Method Summary |
java.lang.String |
getProperty(java.lang.String key,
java.lang.String defaultValue,
java.lang.String categoryName)
This is the real implementation. |
java.lang.String |
getXMLAsString()
This method converts the Configuration into a String
which looks like XML. |
Methods inherited from class org.jconfig.DefaultConfiguration |
addCategoryListener, addCategoryListener, addConfigurationListener, addInclude, addIncludeBlock, addPropertyListener, addPropertyListener, addVariableBlock, containsCategory, escapeForXML, fireConfigurationChangedEvent, getArray, getArray, getArray, getArray, getBaseConfiguration, getBooleanProperty, getBooleanProperty, getCategory, getCategory, getCategoryNames, getCategoryNames, getCharProperty, getCharProperty, getConfigName, getDoubleProperty, getDoubleProperty, getEncoding, getIncludes, getIntProperty, getIntProperty, getLongProperty, getLongProperty, getMainCategoryName, getNumberOfCategories, getProperties, getProperties, getProperties, getProperty, getProperty, getPropertyNames, getSortedProperties, getVariable, getVariables, hasChanged, isNew, markDirty, removeCategory, removeConfigurationListener, removeProperty, removeProperty, renameCategory, resetCreated, setBaseConfiguration, setBooleanProperty, setBooleanProperty, setCategory, setCategory, setCategory, setCharProperty, setCharProperty, setConfigName, setDoubleProperty, setDoubleProperty, setEncoding, setIntProperty, setIntProperty, setLongProperty, setLongProperty, setProperty, setProperty, setVariable, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
ExtensibleConfiguration
public ExtensibleConfiguration(java.lang.String configName)
- The constructor that creates a new configuration
with one empty category called "general". This
category is also the default category.
- Parameters:
configName
- the name of the configuration
getProperty
public java.lang.String getProperty(java.lang.String key,
java.lang.String defaultValue,
java.lang.String categoryName)
- Description copied from class:
DefaultConfiguration
- This is the real implementation. It will return the value of the property
with the specific name. First of all, it checks if the name of the category
exists. If not, then it will use the name of the default category.
The next step is that it will look for the property. If it is not found in
the category, it will look inside the default category (inheritance). If
it still cannot find the property, it will return the defaultValue
- Specified by:
getProperty
in interface Configuration
- Overrides:
getProperty
in class DefaultConfiguration
- Parameters:
key
- the name of the propertydefaultValue
- the default valuecategoryName
- the name of the category
- Returns:
- the value as String
getXMLAsString
public java.lang.String getXMLAsString()
- This method converts the Configuration into a String
which looks like XML.
- Specified by:
getXMLAsString
in interface Configuration
- Overrides:
getXMLAsString
in class DefaultConfiguration
- Returns:
- the Configuration as String in XML format
Copyright © 2001-2005 Andreas Mecky, Terry Dye. All Rights Reserved.