org.yestech.event.listener
Interface IListener<EVENT extends IEvent,RESULT>

Type Parameters:
EVENT - An instance of IEvent
RESULT - The result object
All Known Subinterfaces:
IAggregateListener<EVENT,RESULT>
All Known Implementing Classes:
BaseAggragateListener, BaseListener, FacadeAsyncListener, NoOpListener

public interface IListener<EVENT extends IEvent,RESULT>

Represents a Listener that is executed by a IEventMulticaster. To register a listener with a multicaster atleast one of the following annotations must supplied ListenedEvents, RegisteredEvents. Which annotation depends on the concrete multicaster is being used.


Method Summary
 void deregister()
          DeRegisters the Listener with the IEventMulticaster and all associated events the listener can handle.
 IEventMulticaster<EVENT,RESULT> getMulticaster()
          Result the Multicaster to use when registering the listener.
 void handle(EVENT event, ResultReference<RESULT> result)
          Called by the IEventMulticaster when the Event is fired.
 void register()
          Registers the Listener with the IEventMulticaster and all associated events the listener can handle.
 void setMulticaster(IEventMulticaster<EVENT,RESULT> multicaster)
          The Multicaster to use when registering the listener.
 

Method Detail

handle

void handle(EVENT event,
            ResultReference<RESULT> result)
Called by the IEventMulticaster when the Event is fired.

Parameters:
event - Event registered
result - The result to return

setMulticaster

void setMulticaster(IEventMulticaster<EVENT,RESULT> multicaster)
The Multicaster to use when registering the listener. Should only be called on Construction.

Parameters:
multicaster - The Multicaster

getMulticaster

IEventMulticaster<EVENT,RESULT> getMulticaster()
Result the Multicaster to use when registering the listener.

Returns:
The multicaster

register

@PostConstruct
void register()
Registers the Listener with the IEventMulticaster and all associated events the listener can handle.


deregister

@PreDestroy
void deregister()
DeRegisters the Listener with the IEventMulticaster and all associated events the listener can handle.



Copyright © 2010 YES Technology Association. All Rights Reserved.