public class MultiFileHierarchicalConfiguration extends AbstractHierarchicalFileConfiguration implements ConfigurationListener, ConfigurationErrorListener
AbstractHierarchicalFileConfiguration.FileConfigurationDelegate
HierarchicalConfiguration.BuilderVisitor, HierarchicalConfiguration.Node, HierarchicalConfiguration.NodeVisitor
EVENT_ADD_NODES, EVENT_CLEAR_TREE, EVENT_SUBNODE_CHANGED
END_TOKEN, EVENT_ADD_PROPERTY, EVENT_CLEAR, EVENT_CLEAR_PROPERTY, EVENT_READ_PROPERTY, EVENT_SET_PROPERTY, START_TOKEN
Constructor and Description |
---|
MultiFileHierarchicalConfiguration()
Default Constructor.
|
MultiFileHierarchicalConfiguration(String pathPattern)
Construct the configuration with the specified pattern.
|
Modifier and Type | Method and Description |
---|---|
void |
addConfigurationListener(ConfigurationListener l)
Adds a configuration listener to this object.
|
void |
addErrorListener(ConfigurationErrorListener l)
Adds a new configuration error listener to this object.
|
void |
addNodes(String key,
Collection nodes)
Directly adds sub nodes to this configuration.
|
void |
addProperty(String key,
Object value)
Add a property to the configuration.
|
void |
clear()
Remove all properties from the configuration.
|
void |
clearConfigurationListeners()
Removes all registered configuration listeners.
|
void |
clearErrorListeners()
Removes all registered error listeners.
|
void |
clearProperty(String key)
Removes the property with the given key.
|
void |
clearTree(String key)
Removes all values of the property with the given name and of keys that
start with this name.
|
SubnodeConfiguration |
configurationAt(String key)
Returns a hierarchical subnode configuration for the node specified by
the given key.
|
SubnodeConfiguration |
configurationAt(String key,
boolean supportUpdates)
Returns a hierarchical subnode configuration object that wraps the
configuration node specified by the given key.
|
void |
configurationChanged(ConfigurationEvent event)
Reacts on configuration change events triggered by the delegate.
|
void |
configurationError(ConfigurationErrorEvent event)
Notifies this listener that in an observed configuration an error
occurred.
|
List |
configurationsAt(String key)
Returns a list of sub configurations for all configuration nodes selected
by the given key.
|
boolean |
containsKey(String key)
Checks if the specified key is contained in this configuration.
|
protected AbstractHierarchicalFileConfiguration.FileConfigurationDelegate |
createDelegate()
Creates the file configuration delegate, i.e.
|
BigDecimal |
getBigDecimal(String key)
Get a
BigDecimal associated with the given configuration key. |
BigDecimal |
getBigDecimal(String key,
BigDecimal defaultValue)
Get a
BigDecimal associated with the given configuration key. |
BigInteger |
getBigInteger(String key)
Get a
BigInteger associated with the given configuration key. |
BigInteger |
getBigInteger(String key,
BigInteger defaultValue)
Get a
BigInteger associated with the given configuration key. |
boolean |
getBoolean(String key)
Get a boolean associated with the given configuration key.
|
boolean |
getBoolean(String key,
boolean defaultValue)
Get a boolean associated with the given configuration key.
|
Boolean |
getBoolean(String key,
Boolean defaultValue)
Obtains the value of the specified key and tries to convert it into a
Boolean object. |
byte |
getByte(String key)
Get a byte associated with the given configuration key.
|
byte |
getByte(String key,
byte defaultValue)
Get a byte associated with the given configuration key.
|
Byte |
getByte(String key,
Byte defaultValue)
Get a
Byte associated with the given configuration key. |
Collection |
getConfigurationListeners()
Returns a collection with all configuration event listeners that are
currently registered at this object.
|
double |
getDouble(String key)
Get a double associated with the given configuration key.
|
double |
getDouble(String key,
double defaultValue)
Get a double associated with the given configuration key.
|
Double |
getDouble(String key,
Double defaultValue)
Get a
Double associated with the given configuration key. |
Collection |
getErrorListeners()
Returns a collection with all configuration error listeners that are
currently registered at this object.
|
ExpressionEngine |
getExpressionEngine()
Returns the expression engine used by this configuration.
|
float |
getFloat(String key)
Get a float associated with the given configuration key.
|
float |
getFloat(String key,
float defaultValue)
Get a float associated with the given configuration key.
|
Float |
getFloat(String key,
Float defaultValue)
Get a
Float associated with the given configuration key. |
int |
getInt(String key)
Get a int associated with the given configuration key.
|
int |
getInt(String key,
int defaultValue)
Get a int associated with the given configuration key.
|
Integer |
getInteger(String key,
Integer defaultValue)
Get an
Integer associated with the given configuration key. |
Iterator |
getKeys()
Returns an iterator with all keys defined in this configuration.
|
Iterator |
getKeys(String prefix)
Returns an iterator with all keys defined in this configuration that
start with the given prefix.
|
List |
getList(String key)
Get a List of strings associated with the given configuration key.
|
List |
getList(String key,
List defaultValue)
Get a List of strings associated with the given configuration key.
|
long |
getLong(String key)
Get a long associated with the given configuration key.
|
long |
getLong(String key,
long defaultValue)
Get a long associated with the given configuration key.
|
Long |
getLong(String key,
Long defaultValue)
Get a
Long associated with the given configuration key. |
int |
getMaxIndex(String key)
Returns the maximum defined index for the given key.
|
Properties |
getProperties(String key)
Get a list of properties associated with the given configuration key.
|
Object |
getProperty(String key)
Fetches the specified property.
|
HierarchicalConfiguration.Node |
getRoot()
Returns the root node of this hierarchical configuration.
|
ConfigurationNode |
getRootNode()
Returns the root node of this hierarchical configuration.
|
short |
getShort(String key)
Get a short associated with the given configuration key.
|
short |
getShort(String key,
short defaultValue)
Get a short associated with the given configuration key.
|
Short |
getShort(String key,
Short defaultValue)
Get a
Short associated with the given configuration key. |
String |
getString(String key)
Get a string associated with the given configuration key.
|
String |
getString(String key,
String defaultValue)
Get a string associated with the given configuration key.
|
String[] |
getStringArray(String key)
Get an array of strings associated with the given configuration key.
|
Configuration |
interpolatedConfiguration()
Returns a configuration with the same content as this configuration, but
with all variables replaced by their actual values.
|
boolean |
isEmpty()
Checks if this configuration is empty.
|
void |
load()
Load the configuration from the underlying URL.
|
void |
load(File file)
Load the configuration from the specified file.
|
void |
load(InputStream in)
Load the configuration from the specified stream, using the encoding
returned by
FileConfiguration.getEncoding() . |
void |
load(InputStream in,
String encoding)
Load the configuration from the specified stream, using the specified
encoding.
|
void |
load(Reader reader)
Load the configuration from the specified reader.
|
void |
load(String fileName)
Locate the specified file and load the configuration.
|
void |
load(URL url)
Load the configuration from the specified URL.
|
void |
removeConfiguration()
Remove the current Configuration.
|
boolean |
removeConfigurationListener(ConfigurationListener l)
Removes the specified event listener so that it does not receive any
further events caused by this object.
|
boolean |
removeErrorListener(ConfigurationErrorListener l)
Removes the specified error listener so that it does not receive any
further events caused by this object.
|
protected Object |
resolveContainerStore(String key)
Returns an object from the store described by the key.
|
void |
save()
Save the configuration.
|
void |
save(File file)
Save the configuration to the specified file.
|
void |
save(OutputStream out)
Save the configuration to the specified stream, using the encoding
returned by
FileConfiguration.getEncoding() . |
void |
save(OutputStream out,
String encoding)
Save the configuration to the specified stream, using the specified
encoding.
|
void |
save(String fileName)
Save the configuration to the specified file.
|
void |
save(URL url)
Save the configuration to the specified URL.
|
void |
save(Writer writer)
Save the configuration to the specified writer.
|
void |
setExpressionEngine(ExpressionEngine expressionEngine)
Sets the expression engine to be used by this configuration.
|
void |
setFilePattern(String pathPattern)
Set the File pattern
|
void |
setProperty(String key,
Object value)
Sets the value of the specified property.
|
void |
setRoot(HierarchicalConfiguration.Node node)
Sets the root node of this hierarchical configuration.
|
void |
setRootNode(ConfigurationNode rootNode)
Sets the root node of this hierarchical configuration.
|
Configuration |
subset(String prefix)
Creates a new
Configuration object containing all keys
that start with the specified prefix. |
addPropertyDirect, fetchNodeList, getBasePath, getDelegate, getEncoding, getFile, getFileName, getReloadingStrategy, getURL, isAutoSave, reload, setAutoSave, setBasePath, setDelegate, setEncoding, setFile, setFileName, setReloadingStrategy, setURL, subnodeConfigurationChanged
clearNode, clearNode, clearReferences, clone, createAddPath, createNode, createSubnodeConfiguration, createSubnodeConfiguration, fetchAddNode, findLastPathNode, findPropertyNodes, getDefaultExpressionEngine, nodeDefined, nodeDefined, removeNode, removeNode, setDefaultExpressionEngine
addErrorLogListener, append, clearPropertyDirect, copy, createInterpolator, getDefaultListDelimiter, getDelimiter, getInterpolator, getListDelimiter, getLogger, getProperties, getSubstitutor, interpolate, interpolate, interpolateHelper, isDelimiterParsingDisabled, isThrowExceptionOnMissing, setDefaultListDelimiter, setDelimiter, setDelimiterParsingDisabled, setListDelimiter, setLogger, setThrowExceptionOnMissing
createErrorEvent, createEvent, fireError, fireEvent, isDetailEvents, setDetailEvents
public MultiFileHierarchicalConfiguration()
public MultiFileHierarchicalConfiguration(String pathPattern)
pathPattern
- The pattern to use to locate configuration files.public void setFilePattern(String pathPattern)
pathPattern
- The pattern for the path to the configuration.protected AbstractHierarchicalFileConfiguration.FileConfigurationDelegate createDelegate()
FileConfiguration
interface.
This base implementation will return an instance of the
FileConfigurationDelegate
class. Derived classes may
override it to create a different delegate object.createDelegate
in class AbstractHierarchicalFileConfiguration
public void addProperty(String key, Object value)
Configuration
resource.loader = fileis already present in the configuration and you call
addProperty("resource.loader", "classpath")Then you will end up with a List like the following:
["file", "classpath"]
addProperty
in interface Configuration
addProperty
in class AbstractConfiguration
key
- The key to add the property to.value
- The value to add.public void clear()
Configuration
clear
in interface Configuration
clear
in class AbstractConfiguration
public void clearProperty(String key)
HierarchicalConfiguration
clearProperty
in interface Configuration
clearProperty
in class AbstractHierarchicalFileConfiguration
key
- the key of the property to be removedpublic boolean containsKey(String key)
HierarchicalConfiguration
containsKey
in interface Configuration
containsKey
in class AbstractHierarchicalFileConfiguration
key
- the key to be chekcedpublic BigDecimal getBigDecimal(String key, BigDecimal defaultValue)
Configuration
BigDecimal
associated with the given configuration key.
If the key doesn't map to an existing object, the default value
is returned.getBigDecimal
in interface Configuration
getBigDecimal
in class AbstractConfiguration
key
- The configuration key.defaultValue
- The default value.public BigDecimal getBigDecimal(String key)
AbstractConfiguration
BigDecimal
associated with the given configuration key.getBigDecimal
in interface Configuration
getBigDecimal
in class AbstractConfiguration
key
- The configuration key.AbstractConfiguration.setThrowExceptionOnMissing(boolean)
public BigInteger getBigInteger(String key, BigInteger defaultValue)
Configuration
BigInteger
associated with the given configuration key.
If the key doesn't map to an existing object, the default value
is returned.getBigInteger
in interface Configuration
getBigInteger
in class AbstractConfiguration
key
- The configuration key.defaultValue
- The default value.public BigInteger getBigInteger(String key)
AbstractConfiguration
BigInteger
associated with the given configuration key.getBigInteger
in interface Configuration
getBigInteger
in class AbstractConfiguration
key
- The configuration key.AbstractConfiguration.setThrowExceptionOnMissing(boolean)
public boolean getBoolean(String key, boolean defaultValue)
AbstractConfiguration
getBoolean
in interface Configuration
getBoolean
in class AbstractConfiguration
key
- The configuration key.defaultValue
- The default value.PropertyConverter.toBoolean(Object)
public Boolean getBoolean(String key, Boolean defaultValue)
AbstractConfiguration
Boolean
object. If the property has no value, the passed
in default value will be used.getBoolean
in interface Configuration
getBoolean
in class AbstractConfiguration
key
- the key of the propertydefaultValue
- the default valueBoolean
PropertyConverter.toBoolean(Object)
public boolean getBoolean(String key)
AbstractConfiguration
getBoolean
in interface Configuration
getBoolean
in class AbstractConfiguration
key
- The configuration key.PropertyConverter.toBoolean(Object)
public byte getByte(String key, byte defaultValue)
Configuration
getByte
in interface Configuration
getByte
in class AbstractConfiguration
key
- The configuration key.defaultValue
- The default value.public Byte getByte(String key, Byte defaultValue)
Configuration
Byte
associated with the given configuration key.getByte
in interface Configuration
getByte
in class AbstractConfiguration
key
- The configuration key.defaultValue
- The default value.public byte getByte(String key)
Configuration
getByte
in interface Configuration
getByte
in class AbstractConfiguration
key
- The configuration key.public double getDouble(String key, double defaultValue)
Configuration
getDouble
in interface Configuration
getDouble
in class AbstractConfiguration
key
- The configuration key.defaultValue
- The default value.public Double getDouble(String key, Double defaultValue)
Configuration
Double
associated with the given configuration key.getDouble
in interface Configuration
getDouble
in class AbstractConfiguration
key
- The configuration key.defaultValue
- The default value.public double getDouble(String key)
Configuration
getDouble
in interface Configuration
getDouble
in class AbstractConfiguration
key
- The configuration key.public float getFloat(String key, float defaultValue)
Configuration
getFloat
in interface Configuration
getFloat
in class AbstractConfiguration
key
- The configuration key.defaultValue
- The default value.public Float getFloat(String key, Float defaultValue)
Configuration
Float
associated with the given configuration key.
If the key doesn't map to an existing object, the default value
is returned.getFloat
in interface Configuration
getFloat
in class AbstractConfiguration
key
- The configuration key.defaultValue
- The default value.public float getFloat(String key)
Configuration
getFloat
in interface Configuration
getFloat
in class AbstractConfiguration
key
- The configuration key.public int getInt(String key, int defaultValue)
Configuration
getInt
in interface Configuration
getInt
in class AbstractConfiguration
key
- The configuration key.defaultValue
- The default value.public int getInt(String key)
Configuration
getInt
in interface Configuration
getInt
in class AbstractConfiguration
key
- The configuration key.public Integer getInteger(String key, Integer defaultValue)
Configuration
Integer
associated with the given configuration key.
If the key doesn't map to an existing object, the default value
is returned.getInteger
in interface Configuration
getInteger
in class AbstractConfiguration
key
- The configuration key.defaultValue
- The default value.public Iterator getKeys()
HierarchicalConfiguration
getKeys
in interface Configuration
getKeys
in class AbstractHierarchicalFileConfiguration
public Iterator getKeys(String prefix)
HierarchicalConfiguration
getKeys
in interface Configuration
getKeys
in class AbstractHierarchicalFileConfiguration
prefix
- the prefix of the keys to start withConfiguration.getKeys()
public List getList(String key, List defaultValue)
Configuration
getList
in interface Configuration
getList
in class AbstractConfiguration
key
- The configuration key.defaultValue
- The default value.public List getList(String key)
AbstractConfiguration
getList
in interface Configuration
getList
in class AbstractConfiguration
key
- The configuration key.AbstractConfiguration.getStringArray(String)
public long getLong(String key, long defaultValue)
Configuration
getLong
in interface Configuration
getLong
in class AbstractConfiguration
key
- The configuration key.defaultValue
- The default value.public Long getLong(String key, Long defaultValue)
Configuration
Long
associated with the given configuration key.
If the key doesn't map to an existing object, the default value
is returned.getLong
in interface Configuration
getLong
in class AbstractConfiguration
key
- The configuration key.defaultValue
- The default value.public long getLong(String key)
Configuration
getLong
in interface Configuration
getLong
in class AbstractConfiguration
key
- The configuration key.public Properties getProperties(String key)
Configuration
key=value
. These
strings are splitted at the equals sign, and the key parts will become
keys of the returned Properties
object, the value parts
become values.getProperties
in interface Configuration
getProperties
in class AbstractConfiguration
key
- The configuration key.public Object getProperty(String key)
HierarchicalConfiguration
getProperty
in interface Configuration
getProperty
in class AbstractHierarchicalFileConfiguration
key
- the key to be looked uppublic short getShort(String key, short defaultValue)
Configuration
getShort
in interface Configuration
getShort
in class AbstractConfiguration
key
- The configuration key.defaultValue
- The default value.public Short getShort(String key, Short defaultValue)
Configuration
Short
associated with the given configuration key.
If the key doesn't map to an existing object, the default value
is returned.getShort
in interface Configuration
getShort
in class AbstractConfiguration
key
- The configuration key.defaultValue
- The default value.public short getShort(String key)
Configuration
getShort
in interface Configuration
getShort
in class AbstractConfiguration
key
- The configuration key.public String getString(String key, String defaultValue)
Configuration
getString
in interface Configuration
getString
in class AbstractConfiguration
key
- The configuration key.defaultValue
- The default value.public String getString(String key)
AbstractConfiguration
getString
in interface Configuration
getString
in class AbstractConfiguration
key
- The configuration key.AbstractConfiguration.setThrowExceptionOnMissing(boolean)
public String[] getStringArray(String key)
AbstractConfiguration
setListDelimiter()
method. If this is the case, the string
is splitted at these positions resulting in a property with multiple
values.getStringArray
in interface Configuration
getStringArray
in class AbstractConfiguration
key
- The configuration key.AbstractConfiguration.setListDelimiter(char)
,
AbstractConfiguration.setDelimiterParsingDisabled(boolean)
public boolean isEmpty()
HierarchicalConfiguration
isEmpty
in interface Configuration
isEmpty
in class AbstractHierarchicalFileConfiguration
public void setProperty(String key, Object value)
HierarchicalConfiguration
setProperty
in interface Configuration
setProperty
in class AbstractHierarchicalFileConfiguration
key
- the key of the property to setvalue
- the new value of this propertypublic Configuration subset(String prefix)
HierarchicalConfiguration
Configuration
object containing all keys
that start with the specified prefix. This implementation will return a
HierarchicalConfiguration
object so that the structure of
the keys will be saved. The nodes selected by the prefix (it is possible
that multiple nodes are selected) are mapped to the root node of the
returned configuration, i.e. their children and attributes will become
children and attributes of the new root node. However a value of the root
node is only set if exactly one of the selected nodes contain a value (if
multiple nodes have a value, there is simply no way to decide how these
values are merged together). Note that the returned
Configuration
object is not connected to its source
configuration: updates on the source configuration are not reflected in
the subset and vice versa.subset
in interface Configuration
subset
in class HierarchicalConfiguration
prefix
- the prefix of the keys for the subsetSubsetConfiguration
public HierarchicalConfiguration.Node getRoot()
HierarchicalConfiguration
HierarchicalConfiguration.getRootNode()
method instead, which operates on
the preferred data type ConfigurationNode
.getRoot
in class HierarchicalConfiguration
public void setRoot(HierarchicalConfiguration.Node node)
HierarchicalConfiguration
HierarchicalConfiguration.setRootNode(ConfigurationNode)
method instead,
which operates on the preferred data type ConfigurationNode
.setRoot
in class HierarchicalConfiguration
node
- the root nodepublic ConfigurationNode getRootNode()
HierarchicalConfiguration
getRootNode
in class HierarchicalConfiguration
public void setRootNode(ConfigurationNode rootNode)
HierarchicalConfiguration
setRootNode
in class HierarchicalConfiguration
rootNode
- the root nodepublic ExpressionEngine getExpressionEngine()
HierarchicalConfiguration
getExpressionEngine
in class HierarchicalConfiguration
public void setExpressionEngine(ExpressionEngine expressionEngine)
HierarchicalConfiguration
setExpressionEngine
in class HierarchicalConfiguration
expressionEngine
- the new expression engine; can be null,
then the default expression engine will be usedpublic void addNodes(String key, Collection nodes)
AbstractHierarchicalFileConfiguration
addNodes
in class AbstractHierarchicalFileConfiguration
key
- the key where the nodes are to be addednodes
- a collection with the nodes to be addedpublic SubnodeConfiguration configurationAt(String key, boolean supportUpdates)
HierarchicalConfiguration
Returns a hierarchical subnode configuration object that wraps the
configuration node specified by the given key. This method provides an
easy means of accessing sub trees of a hierarchical configuration. In the
returned configuration the sub tree can directly be accessed, it becomes
the root node of this configuration. Because of this the passed in key
must select exactly one configuration node; otherwise an
IllegalArgumentException
will be thrown.
The difference between this method and the
method is that
HierarchicalConfiguration.subset(String)
subset()
supports arbitrary subsets of configuration nodes
while configurationAt()
only returns a single sub tree.
Please refer to the documentation of the
SubnodeConfiguration
class to obtain further information
about subnode configurations and when they should be used.
With the supportUpdate
flag the behavior of the returned
SubnodeConfiguration
regarding updates of its parent
configuration can be determined. A subnode configuration operates on the
same nodes as its parent, so changes at one configuration are normally
directly visible for the other configuration. There are however changes
of the parent configuration, which are not recognized by the subnode
configuration per default. An example for this is a reload operation (for
file-based configurations): Here the complete node set of the parent
configuration is replaced, but the subnode configuration still references
the old nodes. If such changes should be detected by the subnode
configuration, the supportUpdates
flag must be set to
true. This causes the subnode configuration to reevaluate the key
used for its creation each time it is accessed. This guarantees that the
subnode configuration always stays in sync with its key, even if the
parent configuration's data significantly changes. If such a change
makes the key invalid - because it now no longer points to exactly one
node -, the subnode configuration is not reconstructed, but keeps its
old data. It is then quasi detached from its parent.
configurationAt
in class HierarchicalConfiguration
key
- the key that selects the sub treesupportUpdates
- a flag whether the returned subnode configuration
should be able to handle updates of its parentSubnodeConfiguration
public SubnodeConfiguration configurationAt(String key)
HierarchicalConfiguration
configurationAt(key,
false)
.configurationAt
in class HierarchicalConfiguration
key
- the key that selects the sub treeSubnodeConfiguration
public List configurationsAt(String key)
HierarchicalConfiguration
ExpressionEngine
) and then create a subnode
configuration for each returned node (like
HierarchicalConfiguration.configurationAt(String)
}). This is especially
useful when dealing with list-like structures. As an example consider the
configuration that contains data about database tables and their fields.
If you need access to all fields of a certain table, you can simply do
List fields = config.configurationsAt("tables.table(0).fields.field"); for(Iterator it = fields.iterator(); it.hasNext();) { HierarchicalConfiguration sub = (HierarchicalConfiguration) it.next(); // now the children and attributes of the field node can be // directly accessed String fieldName = sub.getString("name"); String fieldType = sub.getString("type"); ...
configurationsAt
in class HierarchicalConfiguration
key
- the key for selecting the desired nodespublic void clearTree(String key)
HierarchicalConfiguration
clearTree("foo")
would remove both properties.clearTree
in class AbstractHierarchicalFileConfiguration
key
- the key of the property to be removedpublic int getMaxIndex(String key)
HierarchicalConfiguration
getMaxIndex
in class HierarchicalConfiguration
key
- the key to be checkedpublic Configuration interpolatedConfiguration()
HierarchicalConfiguration
interpolatedConfiguration
in class HierarchicalConfiguration
public void addConfigurationListener(ConfigurationListener l)
EventSource
addConfigurationListener
in class EventSource
l
- the listener to addpublic boolean removeConfigurationListener(ConfigurationListener l)
EventSource
removeConfigurationListener
in class EventSource
l
- the listener to be removedpublic Collection getConfigurationListeners()
EventSource
getConfigurationListeners
in class EventSource
ConfigurationListener
s (this collection is a snapshot
of the currently registered listeners; manipulating it has no effect
on this event source object)public void clearConfigurationListeners()
EventSource
clearConfigurationListeners
in class EventSource
public void addErrorListener(ConfigurationErrorListener l)
EventSource
addErrorListener
in class EventSource
l
- the listener to register (must not be null)public boolean removeErrorListener(ConfigurationErrorListener l)
EventSource
removeErrorListener
in class EventSource
l
- the listener to removepublic void clearErrorListeners()
EventSource
clearErrorListeners
in class EventSource
public Collection getErrorListeners()
EventSource
getErrorListeners
in class EventSource
ConfigurationErrorListener
s (this collection is a
snapshot of the currently registered listeners; it cannot be manipulated)public void save(Writer writer) throws ConfigurationException
FileConfiguration
save
in interface FileConfiguration
writer
- the writerConfigurationException
- if an error occurs during the save operationpublic void load(Reader reader) throws ConfigurationException
FileConfiguration
load
in interface FileConfiguration
reader
- the readerConfigurationException
- if an error occurs during the load operationpublic void load() throws ConfigurationException
FileConfiguration
load
in interface FileConfiguration
load
in class AbstractHierarchicalFileConfiguration
ConfigurationException
- if an error occurs during the load operationpublic void load(String fileName) throws ConfigurationException
FileConfiguration
load
in interface FileConfiguration
load
in class AbstractHierarchicalFileConfiguration
fileName
- the name of the file loadedConfigurationException
- if an error occurs during the load operationpublic void load(File file) throws ConfigurationException
FileConfiguration
load
in interface FileConfiguration
load
in class AbstractHierarchicalFileConfiguration
file
- the loaded fileConfigurationException
- if an error occurs during the load operationpublic void load(URL url) throws ConfigurationException
FileConfiguration
load
in interface FileConfiguration
load
in class AbstractHierarchicalFileConfiguration
url
- the URL of the file loadedConfigurationException
- if an error occurs during the load operationpublic void load(InputStream in) throws ConfigurationException
FileConfiguration
FileConfiguration.getEncoding()
.load
in interface FileConfiguration
load
in class AbstractHierarchicalFileConfiguration
in
- the input streamConfigurationException
- if an error occurs during the load operationpublic void load(InputStream in, String encoding) throws ConfigurationException
FileConfiguration
load
in interface FileConfiguration
load
in class AbstractHierarchicalFileConfiguration
in
- the input streamencoding
- the encoding used. null
to use the default encodingConfigurationException
- if an error occurs during the load operationpublic void save() throws ConfigurationException
FileConfiguration
save
in interface FileConfiguration
save
in class AbstractHierarchicalFileConfiguration
ConfigurationException
- if an error occurs during the save operationpublic void save(String fileName) throws ConfigurationException
FileConfiguration
save
in interface FileConfiguration
save
in class AbstractHierarchicalFileConfiguration
fileName
- the name of the file to be savedConfigurationException
- if an error occurs during the save operationpublic void save(File file) throws ConfigurationException
FileConfiguration
save
in interface FileConfiguration
save
in class AbstractHierarchicalFileConfiguration
file
- specifies the file to be savedConfigurationException
- if an error occurs during the save operationpublic void save(URL url) throws ConfigurationException
FileConfiguration
save
in interface FileConfiguration
save
in class AbstractHierarchicalFileConfiguration
url
- the URLConfigurationException
- if an error occurs during the save operationpublic void save(OutputStream out) throws ConfigurationException
FileConfiguration
FileConfiguration.getEncoding()
.save
in interface FileConfiguration
save
in class AbstractHierarchicalFileConfiguration
out
- the output streamConfigurationException
- if an error occurs during the save operationpublic void save(OutputStream out, String encoding) throws ConfigurationException
FileConfiguration
save
in interface FileConfiguration
save
in class AbstractHierarchicalFileConfiguration
out
- the output streamencoding
- the encoding to be usedConfigurationException
- if an error occurs during the save operationpublic void configurationChanged(ConfigurationEvent event)
AbstractHierarchicalFileConfiguration
configurationChanged
in interface ConfigurationListener
configurationChanged
in class AbstractHierarchicalFileConfiguration
event
- the triggered eventpublic void configurationError(ConfigurationErrorEvent event)
ConfigurationErrorListener
Throwable
object, can be obtained from the passed
in event object.configurationError
in interface ConfigurationErrorListener
event
- the event object with information about the errorprotected Object resolveContainerStore(String key)
AbstractConfiguration
resolveContainerStore
in class AbstractConfiguration
key
- The property key.public void removeConfiguration()
Copyright © 2018 JBoss by Red Hat. All rights reserved.