Class MultiFileConfigurationBuilderProvider.WrapperBuilder
- java.lang.Object
-
- org.apache.commons.configuration2.builder.combined.MultiFileConfigurationBuilderProvider.WrapperBuilder
-
- All Implemented Interfaces:
ConfigurationBuilder<Configuration>
,EventSource
- Direct Known Subclasses:
MultiFileConfigurationBuilderProvider.ReloadableWrapperBuilder
- Enclosing class:
- MultiFileConfigurationBuilderProvider
private static class MultiFileConfigurationBuilderProvider.WrapperBuilder extends java.lang.Object implements ConfigurationBuilder<Configuration>
A simple wrapper implementation of theConfigurationBuilder
interface which returns a fix configuration and delegates to another builder for event listener management.
-
-
Field Summary
Fields Modifier and Type Field Description private ConfigurationBuilder<? extends Configuration>
builder
The builder to which this instance delegates.private Configuration
configuration
The configuration managed by this builder.
-
Constructor Summary
Constructors Constructor Description WrapperBuilder(Configuration conf, ConfigurationBuilder<? extends Configuration> bldr)
Creates a new instance ofWrapperBuilder
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T extends Event>
voidaddEventListener(EventType<T> eventType, EventListener<? super T> listener)
Adds an event listener for the specified event type.Configuration
getConfiguration()
Gets the configuration provided by this builder.<T extends Event>
booleanremoveEventListener(EventType<T> eventType, EventListener<? super T> listener)
Removes the event listener registration for the given event type and listener.
-
-
-
Field Detail
-
configuration
private final Configuration configuration
The configuration managed by this builder.
-
builder
private final ConfigurationBuilder<? extends Configuration> builder
The builder to which this instance delegates.
-
-
Constructor Detail
-
WrapperBuilder
public WrapperBuilder(Configuration conf, ConfigurationBuilder<? extends Configuration> bldr)
Creates a new instance ofWrapperBuilder
.- Parameters:
conf
- the managed configurationbldr
- the underlying builder
-
-
Method Detail
-
addEventListener
public <T extends Event> void addEventListener(EventType<T> eventType, EventListener<? super T> listener)
Description copied from interface:EventSource
Adds an event listener for the specified event type. This listener is notified about events of this type and all its sub types.- Specified by:
addEventListener
in interfaceEventSource
- Type Parameters:
T
- the type of events processed by this listener- Parameters:
eventType
- the event type (must not be null)listener
- the listener to be registered (must not be null)
-
getConfiguration
public Configuration getConfiguration() throws ConfigurationException
Description copied from interface:ConfigurationBuilder
Gets the configuration provided by this builder. An implementation has to perform all necessary steps for creating and initializing aImmutableConfiguration
object.- Specified by:
getConfiguration
in interfaceConfigurationBuilder<Configuration>
- Returns:
- the configuration
- Throws:
ConfigurationException
- if an error occurs
-
removeEventListener
public <T extends Event> boolean removeEventListener(EventType<T> eventType, EventListener<? super T> listener)
Description copied from interface:EventSource
Removes the event listener registration for the given event type and listener. An event listener instance may be registered multiple times for different event types. Therefore, when removing a listener the event type of the registration in question has to be specified. The return value indicates whether a registration was removed. A value of false means that no such combination of event type and listener was found.- Specified by:
removeEventListener
in interfaceEventSource
- Type Parameters:
T
- the type of events processed by this listener- Parameters:
eventType
- the event typelistener
- the event listener to be removed- Returns:
- a flag whether a listener registration was removed
-
-