|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sourceforge.hiveevents.ConstraintFilter<T>
public class ConstraintFilter<T>
Event filter that is based on a constraint expressed in a specific language, OCL (Object Constraint Language). Allows to easily define filters that have complex constraints.
The OCL is a simple language that allows evaluation of a boolean expression based on various operators (comparison, boolean arithmetic). It also can reflect any property of the vent to be evaluated (for further checks).
Example:
event.id != 0 && (event.type == 1 || event.type == 2) && event.priority > 2In that example
event is the variable name that can be used to
represent the event to be evaluated by the filter.
| Field Summary | |
|---|---|
static java.lang.String |
EVENT_NAME
|
| Constructor Summary | |
|---|---|
ConstraintFilter(java.lang.String constraint,
java.lang.Class eventClass)
Build a new ConstraintFilter. |
|
ConstraintFilter(java.lang.String constraint,
java.lang.Class eventClass,
java.lang.String argName,
java.lang.Class argClass,
java.lang.Object argValue)
Build a new ConstraintFilter with one additional variable in the expression. |
|
ConstraintFilter(java.lang.String constraint,
java.util.Map<java.lang.String,java.lang.Class> classes,
java.util.Map<java.lang.String,java.lang.Object> values)
Build a new ConstraintFilter with additional variables in the expression. |
|
| Method Summary | |
|---|---|
boolean |
passEvent(T event)
Check if an event must pass to the consumer or not. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String EVENT_NAME
| Constructor Detail |
|---|
public ConstraintFilter(java.lang.String constraint,
java.lang.Class eventClass)
constraint - the expression to evaluate for each eventeventClass - class of the event (used for event reflection control)
public ConstraintFilter(java.lang.String constraint,
java.lang.Class eventClass,
java.lang.String argName,
java.lang.Class argClass,
java.lang.Object argValue)
This is seldom used.
constraint - the expression to evaluate for each eventeventClass - class of the event (used for event reflection control)argName - the name of the additional variable (as used in the
constraint expression)argClass - the class of the additional variable (used for reflection
control)argValue - the value of the additional variable
public ConstraintFilter(java.lang.String constraint,
java.util.Map<java.lang.String,java.lang.Class> classes,
java.util.Map<java.lang.String,java.lang.Object> values)
This is seldom used.
constraint - the expression to evaluate for each eventclasses - the classes of additional variables (used for reflection
control) indexed by name (must contain "event")values - the values of additional variables indexed by name (must
contain "event")| Method Detail |
|---|
public boolean passEvent(T event)
Filter
passEvent in interface Filter<T>event - the event to be checked
true if the event must be notified to the consumer
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||