public class EventListenerParameters extends Object implements BuilderParameters, EventListenerProvider
A specialized parameters implementation for BasicConfigurationBuilder
which allows for a convenient event listener initialization.
This class offers a fluent interface for registering event listeners. A fully
initialized instance can be passed to the
BasicConfigurationBuilder.configure(BuilderParameters...)
method. All
event listeners which have been registered at the instance are then copied
over to the configuration builder.
The code fragment below shows a typical usage scenario:
BasicConfigurationBuilder<Configuration> builder = new BasicConfigurationBuilder<Configuration>( PropertiesConfiguration.class) .configure(new EventListenerParameters().addEventListener( ConfigurationEvent.ANY, myListener));
In order to support a configuration builder's configure()
method,
this class implements the BuilderParameters
interface. However, this
is just a dummy implementation; no parameters are propagated to the builder.
RESERVED_PARAMETER_PREFIX
Constructor and Description |
---|
EventListenerParameters()
Creates a new instance of
EventListenerParameters . |
Modifier and Type | Method and Description |
---|---|
<T extends Event> |
addEventListener(EventListenerRegistrationData<T> registrationData)
Adds the specified
EventListenerRegistrationData instance to this
object. |
<T extends Event> |
addEventListener(EventType<T> eventType,
EventListener<? super T> listener)
Adds an event listener of the specified event type to this object.
|
EventListenerList |
getListeners()
Returns an
EventListenerList object with information about event
listener registrations. |
Map<String,Object> |
getParameters()
Returns a map with all parameters defined by this objects.
|
public EventListenerParameters()
EventListenerParameters
.public <T extends Event> EventListenerParameters addEventListener(EventType<T> eventType, EventListener<? super T> listener)
T
- the event typeeventType
- the event type objectlistener
- the event listenerpublic <T extends Event> EventListenerParameters addEventListener(EventListenerRegistrationData<T> registrationData)
EventListenerRegistrationData
instance to this
object.T
- the event type of the contained event listenerregistrationData
- the registration object to be addedpublic Map<String,Object> getParameters()
Configuration
implementation class the builder produces. The
values are the corresponding property values. The return value must not
be null. This implementation returns an empty map.getParameters
in interface BuilderParameters
public EventListenerList getListeners()
EventListenerProvider
EventListenerList
object with information about event
listener registrations. All listeners contained in this object are added
to the processing ConfigurationBuilder
.getListeners
in interface EventListenerProvider
EventListenerList
with event listener registrations
(must not be null)Copyright © 2001–2018 The Apache Software Foundation. All rights reserved.