loading table of contents...

5.5.3. Boolean Expressions

Interface to implement

For a Boolean expression you need to implement the interface WfBooleanExpression. It extends WfExpression and defines an evaluateExpression() method with a Boolean result.

Convenience classes

For convenience you can subclass from com.coremedia.workflow.common.expressions.AbstractBooleanExpression and implement its evaluateExpression() method.

The abstract classes evaluate() method calls evaluateExpression() and builds a BooleanValue from the returned value. The next example shows a simple Boolean expression which always returns true - a tautology.

public class Tautology extends AbstractBooleanExpression {

  public String getName() {return "Tautology";}

  public boolean evaluateExpression(WfInstance instance, 
                                    Map localVariables) {
    return true;
  }
}

Example 5.8. Example of a Boolean expression