|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.extex.framework.configuration.impl.MultiConfiguration
public class MultiConfiguration
Container for several
Configuration
objects. They can be treated as if they where contained in one configuration.
| Constructor Summary | |
|---|---|
MultiConfiguration(Configuration[] parts)
Creates a new object. |
|
| Method Summary | |
|---|---|
Configuration |
findConfiguration(java.lang.String key)
Extract a sub-configuration with a given name. |
Configuration |
findConfiguration(java.lang.String key,
java.lang.String attribute)
Extract a sub-configuration with a given name and a given attribute. |
java.lang.String |
getAttribute(java.lang.String name)
Getter for an attribute with a given name. |
Configuration |
getConfiguration(java.lang.String key)
Extract a sub-configuration with a given name. |
Configuration |
getConfiguration(java.lang.String key,
java.lang.String attribute)
Extract a sub-configuration with a given name and a given attribute. |
java.lang.String |
getValue()
Getter for the textual value of this configuration. |
java.lang.String |
getValue(java.lang.String key)
Retrieve a value from the configuration as String. |
int |
getValueAsInteger(java.lang.String key,
int defaultValue)
Retrieve a value from the configuration as int. |
void |
getValues(java.util.List<java.lang.String> list,
java.lang.String key)
Get the list of all values with the given tag name in the current configuration and append them to a given String List. |
java.util.List<java.lang.String> |
getValues(java.lang.String key)
Get the list of all values with the given tag name in the current configuration. |
java.util.Iterator<Configuration> |
iterator()
Get an iterator for all sub-configurations. |
java.util.Iterator<Configuration> |
iterator(java.lang.String key)
Retrieve an iterator over all items of a sub-configuration. |
void |
setConfigurationLoader(ConfigurationLoader loader)
Sets a loader for new external sources. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MultiConfiguration(Configuration[] parts)
throws ConfigurationException
parts - the configs to treat jointly
ConfigurationException - in case that the configuration is invalid| Method Detail |
|---|
public Configuration findConfiguration(java.lang.String key)
throws ConfigurationInvalidResourceException,
ConfigurationNotFoundException,
ConfigurationSyntaxException,
ConfigurationIOException
findConfiguration in interface Configurationkey - the tag name of the sub-configuration
null if none is found
ConfigurationInvalidResourceException - in case that the given
resource name is null or empty
ConfigurationNotFoundException - in case that the named path does
not lead to a resource
ConfigurationSyntaxException - in case that the resource contains
syntax errors
ConfigurationIOException - in case of an IO exception while reading
the resourceConfiguration.findConfiguration(
java.lang.String)
public Configuration findConfiguration(java.lang.String key,
java.lang.String attribute)
throws ConfigurationException
ConfigurationConsider the following example with the configuration currently rooted at cfg:
<cfg>
. . .
<abc name="one">
. . .
</abc>
<abc name="two">
. . .
</abc>
. . .
</cfg>
Then getConfig("abc","two") returns a new XMLConfig rooted at the abc with the name attribute "two".
If there are more than one tags with the same name then the first one is used.
If there are no tags with the given name then null is
returned.
findConfiguration in interface Configurationkey - the tag name of the sub-configurationattribute - the value of the attribute name
ConfigurationException - in case of other errors.Configuration.findConfiguration(
java.lang.String, java.lang.String)public java.lang.String getAttribute(java.lang.String name)
getAttribute in interface Configurationname - the tag name of the attribute
null if such an
attribute is not presentConfiguration.getAttribute(
java.lang.String)
public Configuration getConfiguration(java.lang.String key)
throws ConfigurationException
ConfigurationConsider the following example with the configuration currently rooted at cfg:
<cfg>
. . .
<abc>
. . .
</abc>
. . .
</cfg>
Then getConfig("abc") returns a new XMLConfig rooted at abc.
If there are more than one tags with the same name then the first one is used.
If there are no tags with the given name then an exception is thrown.
getConfiguration in interface Configurationkey - the tag name of the sub-configuration
ConfigurationException - in case of other errors. Especially
Configuration.getConfiguration(
java.lang.String)
public Configuration getConfiguration(java.lang.String key,
java.lang.String attribute)
throws ConfigurationException
ConfigurationConsider the following example with the configuration currently rooted at cfg:
<cfg>
. . .
<abc name="one">
. . .
</abc>
<abc name="two">
. . .
</abc>
. . .
</cfg>
Then getConfig("abc","two") returns a new Configuration rooted at the abc with the name attribute "two".
If there are more than one tags with the same name then the first one is used.
If there are no tags with the given name then an exception is thrown.
getConfiguration in interface Configurationkey - the tag name of the sub-configurationattribute - the value of the attribute name
ConfigurationException - in case of other errors. Especially
Configuration.getConfiguration(
java.lang.String, java.lang.String)
public java.lang.String getValue()
throws ConfigurationException
getValue in interface ConfigurationConfigurationException - in case that something went wrongConfiguration.getValue()
public java.lang.String getValue(java.lang.String key)
throws ConfigurationException
ConfigurationConsider the following example with the configuration currently rooted at cfg:
<cfg>
. . .
<one>the first value</one>
<two>the second value</two>
. . .
</cfg>
Then getValue("two") returns the String "the second value".
getValue in interface Configurationkey - the name of the desired value
null
ConfigurationException - in case that something went wrongConfiguration.getValue(java.lang.String)
public int getValueAsInteger(java.lang.String key,
int defaultValue)
throws ConfigurationException
Configuration
getValueAsInteger in interface Configurationkey - the name of the desired valuedefaultValue - the default value
ConfigurationException - in case that something went wrongConfiguration.getValueAsInteger(
java.lang.String, int)
public void getValues(java.util.List<java.lang.String> list,
java.lang.String key)
getValues in interface Configurationlist - the list to append the values tokey - the name of the tags. A value of null is legal.
I this case nothing is appended.Configuration.getValues(
java.util.List, java.lang.String)public java.util.List<java.lang.String> getValues(java.lang.String key)
Configuration
getValues in interface Configurationkey - the name of the tags
Configuration.getValues(java.lang.String)
public java.util.Iterator<Configuration> iterator()
throws ConfigurationException
Configuration
iterator in interface java.lang.Iterable<Configuration>iterator in interface ConfigurationConfigurationException - in case that something went wrongConfiguration.iterator()
public java.util.Iterator<Configuration> iterator(java.lang.String key)
throws ConfigurationException
iterator in interface Configurationkey - the name of the sub-configuration
ConfigurationException - in case that something went wrongConfiguration.iterator(java.lang.String)public void setConfigurationLoader(ConfigurationLoader loader)
setConfigurationLoader in interface Configurationloader - the loaderConfiguration.setConfigurationLoader(
org.extex.framework.configuration.ConfigurationLoader)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||