org.apache.camel.builder
Class ValueBuilder<E extends Exchange>

java.lang.Object
  extended by org.apache.camel.builder.ValueBuilder<E>
All Implemented Interfaces:
Expression<E>
Direct Known Subclasses:
AssertionClause.PredicateValueBuilder

public class ValueBuilder<E extends Exchange>
extends Object
implements Expression<E>

A builder of expressions or predicates based on values.

Version:
$Revision: 745602 $

Constructor Summary
ValueBuilder(Expression<E> expression)
           
 
Method Summary
 ValueBuilder<E> append(Object value)
          Appends the string evaluation of this expression with the given value
protected  Expression<E> asExpression(Object value)
           
 Predicate<E> contains(Object value)
          Create a predicate that the left hand expression contains the value of the right hand expression
 ValueBuilder<E> convertTo(Class type)
          Converts the current value to the given type using the registered type converters
 ValueBuilder<E> convertToString()
          Converts the current value a String using the registered type converters
 Object evaluate(E exchange)
          Returns the value of the expression on the given exchange
 Expression<E> getExpression()
           
 Predicate<E> isEqualTo(Object value)
           
 Predicate<E> isGreaterThan(Object value)
           
 Predicate<E> isGreaterThanOrEqualTo(Object value)
           
 Predicate<E> isInstanceOf(Class type)
           
 Predicate<E> isLessThan(Object value)
           
 Predicate<E> isLessThanOrEqualTo(Object value)
           
 Predicate<E> isNotEqualTo(Object value)
           
 Predicate<E> isNotNull()
           
 Predicate<E> isNull()
           
 Predicate<E> matchesRegex(String regex)
          Deprecated. use regex(String). Will be removed in Camel 2.0
protected  Predicate<E> onNewPredicate(Predicate<E> predicate)
          A strategy method to allow derived classes to deal with the newly created predicate in different ways
 Predicate<E> regex(String regex)
          Creates a predicate which is true if this expression matches the given regular expression
 ValueBuilder<E> regexReplaceAll(String regex, Expression<E> replacement)
          Replaces all occurrences of the regular expression with the given replacement
 ValueBuilder<E> regexReplaceAll(String regex, String replacement)
          Replaces all occurrences of the regular expression with the given replacement
 ValueBuilder<E> regexTokenize(String regex)
          Tokenizes the string conversion of this expression using the given regular expression
 ValueBuilder<E> tokenize()
           
 ValueBuilder<E> tokenize(String token)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ValueBuilder

public ValueBuilder(Expression<E> expression)
Method Detail

evaluate

public Object evaluate(E exchange)
Description copied from interface: Expression
Returns the value of the expression on the given exchange

Specified by:
evaluate in interface Expression<E extends Exchange>
Parameters:
exchange - the message exchange on which to evaluate the expression
Returns:
the value of the expression

getExpression

public Expression<E> getExpression()

toString

public String toString()
Overrides:
toString in class Object

isNotEqualTo

public Predicate<E> isNotEqualTo(Object value)

isEqualTo

public Predicate<E> isEqualTo(Object value)

isLessThan

public Predicate<E> isLessThan(Object value)

isLessThanOrEqualTo

public Predicate<E> isLessThanOrEqualTo(Object value)

isGreaterThan

public Predicate<E> isGreaterThan(Object value)

isGreaterThanOrEqualTo

public Predicate<E> isGreaterThanOrEqualTo(Object value)

isInstanceOf

public Predicate<E> isInstanceOf(Class type)

matchesRegex

public Predicate<E> matchesRegex(String regex)
Deprecated. use regex(String). Will be removed in Camel 2.0


isNull

public Predicate<E> isNull()

isNotNull

public Predicate<E> isNotNull()

contains

public Predicate<E> contains(Object value)
Create a predicate that the left hand expression contains the value of the right hand expression

Parameters:
value - the element which is compared to be contained within this expression
Returns:
a predicate which evaluates to true if the given value expression is contained within this expression value

regex

public Predicate<E> regex(String regex)
Creates a predicate which is true if this expression matches the given regular expression

Parameters:
regex - the regular expression to match
Returns:
a predicate which evaluates to true if the expression matches the regex

tokenize

public ValueBuilder<E> tokenize()

tokenize

public ValueBuilder<E> tokenize(String token)

regexTokenize

public ValueBuilder<E> regexTokenize(String regex)
Tokenizes the string conversion of this expression using the given regular expression


regexReplaceAll

public ValueBuilder<E> regexReplaceAll(String regex,
                                       String replacement)
Replaces all occurrences of the regular expression with the given replacement


regexReplaceAll

public ValueBuilder<E> regexReplaceAll(String regex,
                                       Expression<E> replacement)
Replaces all occurrences of the regular expression with the given replacement


convertTo

public ValueBuilder<E> convertTo(Class type)
Converts the current value to the given type using the registered type converters

Parameters:
type - the type to convert the value to
Returns:
the current builder

convertToString

public ValueBuilder<E> convertToString()
Converts the current value a String using the registered type converters

Returns:
the current builder

append

public ValueBuilder<E> append(Object value)
Appends the string evaluation of this expression with the given value

Parameters:
value - the value or expression to append
Returns:
the current builder

onNewPredicate

protected Predicate<E> onNewPredicate(Predicate<E> predicate)
A strategy method to allow derived classes to deal with the newly created predicate in different ways


asExpression

protected Expression<E> asExpression(Object value)


Copyright © 2009 Apache Software Foundation. All Rights Reserved.