com.hammurapi.eventbus
Annotation Type Observer


@Target(value=METHOD)
@Retention(value=RUNTIME)
public @interface Observer

Annotation to mark observer methods.


Optional Element Summary
 boolean consumes
           
 boolean oneOff
           
 Class<?>[] posts
          This optional attribute informs the bus about event types which this method posts (if any).
 int priority
           
 String[] value
          Condition definition has the following format [language://][parameter list:] condition expression.
 

priority

public abstract int priority
Returns:
Observer method priority. Methods with higher priority value get invoked before methods with lower priority value. Observeer method can invoke consume() method from EventDispatchContext to "consume" source fact(s) and prevent invocation of subsequent handler methods.
Default:
0

value

public abstract String[] value
Condition definition has the following format [language://][parameter list:] condition expression. Default language is Java. If language is not Java, then Java Scripting Framework is used to look up a script engine to evaluate the expression. Parameter list is a comma separated list of parameter names, parameters not used in the condition expression can be omitted. E.g. parent, child, sibling or, if child is not used in the condition expression parent,,sibling. If parameter list is omitted, then arguments are named arg0, arg1, etc. for method level conditions and arg for parameter level conditions. Condition expression is a fragment of Java code returning boolean. Rule instance is available through rule parameter.

Returns:
True if condition is fulfilled and further rule evaluation shall be attempted. If several conditions are specified, then they are connected by AND and it is assumed that they can be reordered by the rule compilation/execution engine to build conditions chain.
Default:
{}

posts

public abstract Class<?>[] posts
This optional attribute informs the bus about event types which this method posts (if any). It allows the engine to optimize the predicate network.

Returns:
Default:
{}

consumes

public abstract boolean consumes
Returns:
true if this observer consumes or updates events.
Default:
true

oneOff

public abstract boolean oneOff
Returns:
true if this observer shall be invoked only once.
Default:
false