|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.neeve.root.RootObject
com.neeve.aep.AepEventDispatcher
public final class AepEventDispatcher
Nested Class Summary | |
---|---|
static class |
AepEventDispatcher.DefaultHandlerDispatchPolicy
Enumerates the various default handler dispatch policies |
Method Summary | |
---|---|
void |
appendEventHandlerDeclarations(Class<?> eventType,
String prefix,
StringBuilder builder)
Appends the list of a event handlers for the given type to a StringBuilder. |
static AepEventDispatcher |
create(Set<Object> eventHandlerContainers,
IEventHandler defaultEventHandler)
Create a new event dispatcher This method invokes create(eventHandlerContainers, defaultEventHandler, null)
|
static AepEventDispatcher |
create(Set<Object> eventHandlerContainers,
IEventHandler defaultEventHandler,
IAepApplicationStateFactory stateFactory)
Create a new event dispatcher |
void |
dispatchToEventHandlers(Object event)
Dispatch an event to its handlers. |
AepEventDispatcher.DefaultHandlerDispatchPolicy |
getDefaultHandlerDispatchPolicy()
Get the default handler dispatch policy |
Set<Object> |
getEventHandlerContainers()
Get the event handler containers |
Set<Class<?>> |
getHandledEventClasses()
Get the set of handled events |
void |
getHandlerMethodsFor(Class<?> eventType,
List<Method> results)
Adds the list of handler methods for a given type to the provide list. |
void |
onEvent(Event event)
Implementation of IEventHandler.onEvent(com.neeve.event.Event) |
void |
setDefaultHandlerDispatchPolicy(AepEventDispatcher.DefaultHandlerDispatchPolicy policy)
Set the default handler dispatch policy |
Methods inherited from class com.neeve.root.RootObject |
---|
getChecked, getThreaded, getTracer, setChecked, setTracer |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static final AepEventDispatcher create(Set<Object> eventHandlerContainers, IEventHandler defaultEventHandler, IAepApplicationStateFactory stateFactory)
eventHandlerContainers
- The objects that contain the event handlers
(methods annotated with EventHandler
)defaultEventHandler
- The default event handlerstateFactory
- A state factory for the dispatcher to use to determine
the class of the root state object (repository) to discover event handlers
with repository argument. A null value in this parameter will result in
the dispatcher not discovering event handlers with a repository argumentpublic static final AepEventDispatcher create(Set<Object> eventHandlerContainers, IEventHandler defaultEventHandler)
This method invokes create(eventHandlerContainers, defaultEventHandler, null)
public final Set<Object> getEventHandlerContainers()
public final Set<Class<?>> getHandledEventClasses()
public final void getHandlerMethodsFor(Class<?> eventType, List<Method> results)
eventType
- The type for which to look up event handlers.results
- The target list to which to add the event handler methods.public final void appendEventHandlerDeclarations(Class<?> eventType, String prefix, StringBuilder builder)
eventType
- The type for which to look up event handlers.prefix
- A prefix to append to each event handler line listed.builder
- The StringBuilder to which to append.public final void setDefaultHandlerDispatchPolicy(AepEventDispatcher.DefaultHandlerDispatchPolicy policy)
public final AepEventDispatcher.DefaultHandlerDispatchPolicy getDefaultHandlerDispatchPolicy()
public final void dispatchToEventHandlers(Object event)
event
- The event to dispatch. The event's type (class)
determines the event handler to which it will be dispatched.
This method dispatches an event to its registered handlers i.e.
methods annotated using the EventHandler
annotation.
The handlers to which the event is dispatched is identified
by the event's type (class).
Note: This method does not dispatch to event handlers that
contain the application repository as the second
argument in its method signature
public final void onEvent(Event event)
IEventHandler.onEvent(com.neeve.event.Event)
onEvent
in interface IEventHandler
event
- The event to be handled.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |