|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.apache.commons.configuration.AbstractConfiguration
org.apache.commons.configuration.BaseConfiguration
org.apache.commons.configuration.AbstractFileConfiguration
org.apache.commons.configuration.XMLConfiguration
Reads a XML configuration file.
To retrieve the value of an attribute of an element, use
X.Y.Z[@attribute]. The '@' symbol was chosen for consistency
with XPath.
Setting property values will NOT automatically persist changes to
disk, unless autoSave=true.
| Nested Class Summary |
| Nested classes inherited from class org.apache.commons.configuration.AbstractConfiguration |
AbstractConfiguration.PropertiesTokenizer |
| Field Summary |
| Fields inherited from class org.apache.commons.configuration.AbstractFileConfiguration |
basePath, fileName, url |
| Fields inherited from class org.apache.commons.configuration.AbstractConfiguration |
END_TOKEN, START_TOKEN |
| Constructor Summary | |
XMLConfiguration()
Creates an empty XML configuration. |
|
XMLConfiguration(File file)
Creates and loads the XML configuration from the specified file. |
|
XMLConfiguration(String resource)
Creates and loads the XML configuration from the specified resource. |
|
XMLConfiguration(URL url)
Creates and loads the XML configuration from the specified URL. |
|
| Method Summary | |
void |
addProperty(String name,
Object value)
Calls super method, and also ensures the underlying is modified so changes are persisted when saved. |
void |
clearProperty(String name)
Calls super method, and also ensures the underlying Documentis
modified so changes are persisted when saved. |
(package private) Object |
getXmlProperty(String name)
|
void |
load(Reader in)
Load the configuration from the specified reader. |
protected static String |
parseAttributeName(String key)
Parse a property key and return the attribute name if it existst. |
protected static String[] |
parseElementNames(String key)
Parse a property key and return an array of the element hierarchy it specifies. |
void |
save(Writer writer)
Save the configuration to the specified writer. |
void |
setAutoSave(boolean autoSave)
If true, changes are automatically persisted. |
String |
toString()
|
| Methods inherited from class org.apache.commons.configuration.AbstractFileConfiguration |
getBasePath, getFile, getFileName, getURL, load, load, load, load, load, load, save, save, save, save, save, save, setBasePath, setFile, setFileName, setURL |
| Methods inherited from class org.apache.commons.configuration.BaseConfiguration |
addPropertyDirect, containsKey, getKeys, getPropertyDirect, isEmpty |
| Methods inherited from class org.apache.commons.configuration.AbstractConfiguration |
getBigDecimal, getBigDecimal, getBigInteger, getBigInteger, getBoolean, getBoolean, getBoolean, getByte, getByte, getByte, getDelimiter, getDouble, getDouble, getDouble, getFloat, getFloat, getFloat, getInt, getInt, getInteger, getKeys, getList, getList, getLong, getLong, getLong, getProperties, getProperties, getProperty, getShort, getShort, getShort, getString, getString, getStringArray, getVector, getVector, interpolate, interpolateHelper, isThrowExceptionOnMissing, setDelimiter, setProperty, setThrowExceptionOnMissing, split, subset |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.apache.commons.configuration.Configuration |
containsKey, getBigDecimal, getBigDecimal, getBigInteger, getBigInteger, getBoolean, getBoolean, getBoolean, getByte, getByte, getByte, getDouble, getDouble, getDouble, getFloat, getFloat, getFloat, getInt, getInt, getInteger, getKeys, getKeys, getList, getList, getLong, getLong, getLong, getProperties, getProperty, getShort, getShort, getShort, getString, getString, getStringArray, getVector, getVector, isEmpty, setProperty, subset |
| Constructor Detail |
public XMLConfiguration()
public XMLConfiguration(String resource)
throws ConfigurationException
resource - The name of the resource to load.
ConfigurationException - Error while loading the XML file
public XMLConfiguration(File file)
throws ConfigurationException
file - The XML file to load.
ConfigurationException - Error while loading the XML file
public XMLConfiguration(URL url)
throws ConfigurationException
url - The location of the XML file to load.
ConfigurationException - Error while loading the XML file| Method Detail |
public void load(Reader in)
throws ConfigurationException
in - the reader
ConfigurationException
public void addProperty(String name,
Object value)
addProperty in interface ConfigurationaddProperty in class AbstractConfigurationname - value - Object getXmlProperty(String name)
public void clearProperty(String name)
Documentis
modified so changes are persisted when saved.
clearProperty in interface ConfigurationclearProperty in class BaseConfigurationname - The name of the property to clear.public void setAutoSave(boolean autoSave)
autoSave -
public void save(Writer writer)
throws ConfigurationException
writer - the writer
ConfigurationExceptionpublic String toString()
protected static String[] parseElementNames(String key)
key - the key to parse
protected static String parseAttributeName(String key)
key - the key to parse
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||