The main Configuration interface.
This interface allows accessing and manipulating a configuration object. The major part of the methods defined in this interface deals with accessing properties of various data types. There is a generic {@code getProperty()}method, which returns the value of the queried property in its raw data type. Other getter methods try to convert this raw data type into a specific data type. If this fails, a {@code ConversionException} will be thrown.
For most of the property getter methods an overloaded version exists that allows to specify a default value, which will be returned if the queried property cannot be found in the configuration. The behavior of the methods that do not take a default value in case of a missing property is not defined by this interface and depends on a concrete implementation. E.g. the {@link AbstractConfiguration} class, which is the base classof most configuration implementations provided by this package, per default returns null if a property is not found, but provides the {@link AbstractConfiguration#setThrowExceptionOnMissing(boolean) setThrowExceptionOnMissing()}method, with which it can be configured to throw a {@code NoSuchElementException}exception in that case. (Note that getter methods for primitive types in {@code AbstractConfiguration} always throw an exception for missingproperties because there is no way of overloading the return value.)
With the {@code addProperty()} and {@code setProperty()} methodsnew properties can be added to a configuration or the values of properties can be changed. With {@code clearProperty()} a property can be removed.Other methods allow to iterate over the contained properties or to create a subset configuration.
@author Commons Configuration team @version $Id: Configuration.java 1624601 2014-09-12 18:04:36Z oheger $
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|