Class BaseEventHandler
- java.lang.Object
-
- org.adempiere.base.event.annotations.BaseEventHandler
-
- All Implemented Interfaces:
org.osgi.service.event.EventHandler
- Direct Known Subclasses:
ImportEventHandler
,ModelEventHandler
,ProcessEventHandler
,SimpleEventHandler
public abstract class BaseEventHandler extends Object implements org.osgi.service.event.EventHandler
Base class for event handler that works with annotation driven event delegate. The implementation of event delegate doesn't have to be thread safe as a new instance of delegate is created for each event call.- Author:
- hengsin
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<String,Method>
eventTopicMap
-
Constructor Summary
Constructors Constructor Description BaseEventHandler(Class<? extends EventDelegate> delegateClass)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
createTopicMap(Class<?> delegateClass)
create event to topic to method mapping from annotationsString
getFilter()
String[]
getTopics()
void
handleEvent(org.osgi.service.event.Event event)
protected abstract EventDelegate
newEventDelegate(org.osgi.service.event.Event event)
create new instance of event delegatevoid
setEventPropertyFilter(String propertyName, String value)
void
setFilter(String filter)
set event filter
-
-
-
Constructor Detail
-
BaseEventHandler
public BaseEventHandler(Class<? extends EventDelegate> delegateClass)
- Parameters:
delegateClass
-
-
-
Method Detail
-
createTopicMap
protected void createTopicMap(Class<?> delegateClass)
create event to topic to method mapping from annotations- Parameters:
delegateClass
-
-
getTopics
public String[] getTopics()
- Returns:
- arrays of event topic
-
getFilter
public String getFilter()
- Returns:
- event filter
-
setFilter
public void setFilter(String filter)
set event filter- Parameters:
filter
-
-
setEventPropertyFilter
public void setEventPropertyFilter(String propertyName, String value)
- Parameters:
propertyName
-value
-
-
handleEvent
public void handleEvent(org.osgi.service.event.Event event)
- Specified by:
handleEvent
in interfaceorg.osgi.service.event.EventHandler
-
newEventDelegate
protected abstract EventDelegate newEventDelegate(org.osgi.service.event.Event event)
create new instance of event delegate- Parameters:
event
-- Returns:
EventDelegate
-
-