Abstract configuration class. Provides basic functionality but does not store any data.
If you want to write your own Configuration class then you should implement only abstract methods from this class. A lot of functionality needed by typical implementations of the {@code Configuration}interface is already provided by this base class. Following is a list of features implemented here:
- Data conversion support. The various data types required by the {@code Configuration} interface are already handled by this base class.A concrete sub class only needs to provide a generic {@code getProperty()}method.
- Support for variable interpolation. Property values containing special variable tokens (like
${var}
) will be replaced by their corresponding values. - Optional support for string lists. The values of properties to be added to this configuration are checked whether they contain a list delimiter character. If this is the case and if list splitting is enabled, the string is split and multiple values are added for this property. List splitting is controlled by a {@link ListDelimiterHandler} object which can be set using the{@link #setListDelimiterHandler(ListDelimiterHandler)} method. It isdisabled per default. To enable this feature, set a suitable {@code ListDelimiterHandler}, e.g. an instance of {@link DefaultListDelimiterHandler} configured with the desired listdelimiter character.
- Allows specifying how missing properties are treated. Per default the get methods returning an object will return null if the searched property key is not found (and no default value is provided). With the {@code setThrowExceptionOnMissing()} method this behavior can bechanged to throw an exception when a requested property cannot be found.
- Basic event support. Whenever this configuration is modified registered event listeners are notified. Refer to the various {@code EVENT_XXX}constants to get an impression about which event types are supported.
- Support for proper synchronization based on the {@link Synchronizer}interface.
Most methods defined by the {@code Configuration} interface are alreadyimplemented in this class. Many method implementations perform basic book-keeping tasks (e.g. firing events, handling synchronization), and then delegate to other (protected) methods executing the actual work. Subclasses override these protected methods to define or adapt behavior. The public entry point methods are final to prevent subclasses from breaking basic functionality.
@author
Konstantin Shaposhnikov
@author
Henning P. Schmiedehausen
@version $Id: AbstractConfiguration.java 1624601 2014-09-12 18:04:36Z oheger $