org.apache.camel.builder
Class PredicateBuilder

java.lang.Object
  extended by org.apache.camel.builder.PredicateBuilder

public final class PredicateBuilder
extends Object

A helper class for working with predicates

Version:

Method Summary
static Predicate and(List<Predicate> predicates)
          Concat the given predicates into a single predicate, which only matches if all the predicates matches.
static Predicate and(Predicate left, Predicate right)
          A helper method to combine multiple predicates by a logical AND
static Predicate constant(boolean answer)
          A constant predicate.
static Predicate contains(Expression left, Expression right)
           
static Predicate endsWith(Expression left, Expression right)
           
static Predicate in(Predicate... predicates)
          A helper method to return true if any of the predicates matches.
static Predicate isEqualTo(Expression left, Expression right)
           
static Predicate isGreaterThan(Expression left, Expression right)
           
static Predicate isGreaterThanOrEqualTo(Expression left, Expression right)
           
static Predicate isInstanceOf(Expression expression, Class<?> type)
           
static Predicate isLessThan(Expression left, Expression right)
           
static Predicate isLessThanOrEqualTo(Expression left, Expression right)
           
static Predicate isNotEqualTo(Expression left, Expression right)
           
static Predicate isNotNull(Expression expression)
           
static Predicate isNull(Expression expression)
           
static Predicate not(Predicate predicate)
          A helper method to return the logical not of the given predicate
static Predicate or(Predicate left, Predicate right)
          A helper method to combine multiple predicates by a logical OR
static Predicate regex(Expression expression, Pattern pattern)
          Returns a predicate which is true if the expression matches the given regular expression
static Predicate regex(Expression expression, String regex)
          Returns a predicate which is true if the expression matches the given regular expression
static Predicate startsWith(Expression left, Expression right)
           
static Predicate toPredicate(Expression expression)
          Converts the given expression into an Predicate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

toPredicate

public static Predicate toPredicate(Expression expression)
Converts the given expression into an Predicate


not

public static Predicate not(Predicate predicate)
A helper method to return the logical not of the given predicate


and

public static Predicate and(Predicate left,
                            Predicate right)
A helper method to combine multiple predicates by a logical AND


or

public static Predicate or(Predicate left,
                           Predicate right)
A helper method to combine multiple predicates by a logical OR


in

public static Predicate in(Predicate... predicates)
A helper method to return true if any of the predicates matches.


isEqualTo

public static Predicate isEqualTo(Expression left,
                                  Expression right)

isNotEqualTo

public static Predicate isNotEqualTo(Expression left,
                                     Expression right)

isLessThan

public static Predicate isLessThan(Expression left,
                                   Expression right)

isLessThanOrEqualTo

public static Predicate isLessThanOrEqualTo(Expression left,
                                            Expression right)

isGreaterThan

public static Predicate isGreaterThan(Expression left,
                                      Expression right)

isGreaterThanOrEqualTo

public static Predicate isGreaterThanOrEqualTo(Expression left,
                                               Expression right)

contains

public static Predicate contains(Expression left,
                                 Expression right)

isNull

public static Predicate isNull(Expression expression)

isNotNull

public static Predicate isNotNull(Expression expression)

isInstanceOf

public static Predicate isInstanceOf(Expression expression,
                                     Class<?> type)

startsWith

public static Predicate startsWith(Expression left,
                                   Expression right)

endsWith

public static Predicate endsWith(Expression left,
                                 Expression right)

regex

public static Predicate regex(Expression expression,
                              String regex)
Returns a predicate which is true if the expression matches the given regular expression

Parameters:
expression - the expression to evaluate
regex - the regular expression to match against
Returns:
a new predicate

regex

public static Predicate regex(Expression expression,
                              Pattern pattern)
Returns a predicate which is true if the expression matches the given regular expression

Parameters:
expression - the expression to evaluate
pattern - the regular expression to match against
Returns:
a new predicate

and

public static Predicate and(List<Predicate> predicates)
Concat the given predicates into a single predicate, which only matches if all the predicates matches.

Parameters:
predicates - predicates
Returns:
a single predicate containing all the predicates

constant

public static Predicate constant(boolean answer)
A constant predicate.

Parameters:
answer - the constant matches
Returns:
a predicate that always returns the given answer.


Apache CAMEL