org.omnaest.utils.events.concrete
Class EventManagerImpl<EVENT,RESULT>

java.lang.Object
  extended by org.omnaest.utils.events.concrete.EventManagerImpl<EVENT,RESULT>
Type Parameters:
EVENT -
RESULT -
All Implemented Interfaces:
Serializable, EventManager<EVENT,RESULT>, EventProducer<EVENT,RESULT>

public class EventManagerImpl<EVENT,RESULT>
extends Object
implements EventProducer<EVENT,RESULT>, EventManager<EVENT,RESULT>

Manager for EventListener instances which implements the EventListener interface, too. The EventListener.handleEvent(Object) is executed for all of the EventListener instances which are not null.

To add new EventListener instances use the EventListenerRegistrationImpl instance which can be retrieved via getEventListenerRegistration(). Its best practice to make this method available to clients by a delegate method.

Author:
Omnaest
See Also:
EventProducer, Serialized Form

Field Summary
protected  EventListenerRegistration<EVENT,RESULT> eventListenerRegistration
           
protected  EventManagerConnector<EVENT,RESULT> eventManagerConnector
           
protected  List<EventListener<EVENT,RESULT>> listenerList
           
 
Constructor Summary
EventManagerImpl()
           
 
Method Summary
 EventManager<EVENT,RESULT> clearListeners()
          Removes all listeners from the EventManagerImpl instance.
 EventResults<RESULT> fireEvent(EVENT parameter)
          Simple method for handling events.
 EventListenerRegistration<EVENT,RESULT> getEventListenerRegistration()
          Offers the EventListenerRegistration to register EventListener to this instance.
 EventManagerConnector<EVENT,RESULT> getEventManagerConnector()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

listenerList

protected List<EventListener<EVENT,RESULT>> listenerList

eventListenerRegistration

protected EventListenerRegistration<EVENT,RESULT> eventListenerRegistration

eventManagerConnector

protected EventManagerConnector<EVENT,RESULT> eventManagerConnector
Constructor Detail

EventManagerImpl

public EventManagerImpl()
See Also:
EventManagerImpl
Method Detail

clearListeners

public EventManager<EVENT,RESULT> clearListeners()
Removes all listeners from the EventManagerImpl instance.

Specified by:
clearListeners in interface EventManager<EVENT,RESULT>
Returns:
this

fireEvent

public EventResults<RESULT> fireEvent(EVENT parameter)
Simple method for handling events.

Specified by:
fireEvent in interface EventManager<EVENT,RESULT>
Parameters:
parameter -
Returns:
See Also:
#fireEvent(Object, EventListenerRegistrationImpl)

getEventListenerRegistration

public EventListenerRegistration<EVENT,RESULT> getEventListenerRegistration()
Description copied from interface: EventProducer
Offers the EventListenerRegistration to register EventListener to this instance. All events will be signaled to the EventListeners from the time on they get registered.

Specified by:
getEventListenerRegistration in interface EventProducer<EVENT,RESULT>
Returns:
See Also:
EventListenerRegistration, EventProducer

getEventManagerConnector

public EventManagerConnector<EVENT,RESULT> getEventManagerConnector()
Specified by:
getEventManagerConnector in interface EventManager<EVENT,RESULT>
Returns:
See Also:
EventManagerConnector


Copyright © 2013. All Rights Reserved.