org.apache.camel.builder
Class BinaryPredicateSupport

java.lang.Object
  extended by org.apache.camel.builder.BinaryPredicateSupport
All Implemented Interfaces:
BinaryPredicate, Predicate

public abstract class BinaryPredicateSupport
extends Object
implements BinaryPredicate

A useful base class for Predicate implementations

Version:
$Revision: 1003810 $

Constructor Summary
protected BinaryPredicateSupport(Expression left, Expression right)
           
 
Method Summary
 Expression getLeft()
          Gets the left hand side expression
 Object getLeftValue()
          Gets the evaluated left hand side value.
protected abstract  String getOperationText()
           
 String getOperator()
          Gets the operator
 Expression getRight()
          Gets the right hand side expression
 Object getRightValue()
          Gets the evaluated right hand side value.
 boolean matches(Exchange exchange)
          Evaluates the predicate on the message exchange and returns true if this exchange matches the predicate
protected abstract  boolean matches(Exchange exchange, Object leftValue, Object rightValue)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BinaryPredicateSupport

protected BinaryPredicateSupport(Expression left,
                                 Expression right)
Method Detail

toString

public String toString()
Overrides:
toString in class Object

matches

public boolean matches(Exchange exchange)
Description copied from interface: Predicate
Evaluates the predicate on the message exchange and returns true if this exchange matches the predicate

Specified by:
matches in interface Predicate
Parameters:
exchange - the message exchange
Returns:
true if the predicate matches

matches

protected abstract boolean matches(Exchange exchange,
                                   Object leftValue,
                                   Object rightValue)

getOperationText

protected abstract String getOperationText()

getRight

public Expression getRight()
Description copied from interface: BinaryPredicate
Gets the right hand side expression

Specified by:
getRight in interface BinaryPredicate
Returns:
the right expression

getLeft

public Expression getLeft()
Description copied from interface: BinaryPredicate
Gets the left hand side expression

Specified by:
getLeft in interface BinaryPredicate
Returns:
the left expression

getOperator

public String getOperator()
Description copied from interface: BinaryPredicate
Gets the operator

Specified by:
getOperator in interface BinaryPredicate
Returns:
the operator text

getRightValue

public Object getRightValue()
Description copied from interface: BinaryPredicate
Gets the evaluated right hand side value.

Beware of thread safety that the result of the BinaryPredicate.getLeftValue() may in fact be from another evaluation.

Specified by:
getRightValue in interface BinaryPredicate
Returns:
the right value, may be null if predicate has not been matched yet.

getLeftValue

public Object getLeftValue()
Description copied from interface: BinaryPredicate
Gets the evaluated left hand side value.

Beware of thread safety that the result of the BinaryPredicate.getRightValue() may in fact be from another evaluation.

Specified by:
getLeftValue in interface BinaryPredicate
Returns:
the left value, may be null if predicate has not been matched yet.


Apache CAMEL