Package net.engio.mbassy.listener
Annotation Interface Handler
Mark any method of any class(=listener) as a message handler and configure the handler
using different properties.
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionDefines a filter condition as Expression Language.Define the mode in which a message is delivered to each listener.boolean
Enable or disable the handler.Filter[]
Add any numbers of filters to the handler.Class
<? extends HandlerInvocation> Each handler call is implemented as an invocation object that implements the invocation mechanism.int
Handlers are ordered by priority and handlers with higher priority are processed before those with lower priority, i.e.boolean
Define whether or not the handler accepts sub types of the message type it declares in its signature.
-
Element Details
-
filters
Filter[] filtersAdd any numbers of filters to the handler. All filters are evaluated before the handler is actually invoked, which is only if all the filters accept the message.- Default:
{}
-
condition
String conditionDefines a filter condition as Expression Language. This can be used to filter the events based on attributes of the event object. Note that the expression must resolve to eithertrue
to allow the event orfalse
to block it from delivery to the handler. The message itself is available as "msg" variable.- Returns:
- the condition in EL syntax.
- Default:
""
-
delivery
Invoke deliveryDefine the mode in which a message is delivered to each listener. Listeners can be notified sequentially or concurrently.- Default:
Synchronously
-
priority
int priorityHandlers are ordered by priority and handlers with higher priority are processed before those with lower priority, i.e. Influence the order in which different handlers that consume the same message type are invoked.- Default:
0
-
rejectSubtypes
boolean rejectSubtypesDefine whether or not the handler accepts sub types of the message type it declares in its signature.- Default:
false
-
enabled
boolean enabledEnable or disable the handler. Disabled handlers do not receive any messages. This property is useful for quick changes in configuration and necessary to disable handlers that have been declared by a superclass but do not apply to the subclass- Default:
true
-
invocation
Class<? extends HandlerInvocation> invocationEach handler call is implemented as an invocation object that implements the invocation mechanism. The basic implementation uses reflection and is the default. It is possible though to provide a custom invocation to add additional logic. Note: Providing a custom invocation will most likely reduce performance, since the JIT-Compiler can not do some of its sophisticated byte code optimizations.- Default:
net.engio.mbassy.dispatch.ReflectiveHandlerInvocation.class
-