org.apache.camel.builder
Class ValueBuilder

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

public class ValueBuilder
extends Object
implements Expression

A builder of expressions or predicates based on values.

Version:

Constructor Summary
ValueBuilder(Expression expression)
           
 
Method Summary
 ValueBuilder append(Object value)
          Appends the string evaluation of this expression with the given value
protected  Expression asExpression(Object value)
           
 Predicate contains(Object value)
          Create a predicate that the left hand expression contains the value of the right hand expression
 ValueBuilder convertTo(Class<?> type)
          Converts the current value to the given type using the registered type converters
 ValueBuilder convertToString()
          Converts the current value to a String using the registered type converters
 Predicate endsWith(Object value)
           
<T> T
evaluate(Exchange exchange, Class<T> type)
          Returns the value of the expression on the given exchange
 Expression getExpression()
           
 Predicate in(Object... values)
           
 Predicate in(Predicate... predicates)
           
 Predicate isEqualTo(Object value)
           
 Predicate isGreaterThan(Object value)
           
 Predicate isGreaterThanOrEqualTo(Object value)
           
 Predicate isInstanceOf(Class<?> type)
           
 Predicate isLessThan(Object value)
           
 Predicate isLessThanOrEqualTo(Object value)
           
 Predicate isNotEqualTo(Object value)
           
 Predicate isNotNull()
           
 Predicate isNull()
           
 ExpressionClause<Predicate> matches()
           
 Predicate matches(Expression expression)
           
 Predicate not(Predicate predicate)
           
protected  Predicate onNewPredicate(Predicate predicate)
          A strategy method to allow derived classes to deal with the newly created predicate in different ways
 ValueBuilder prepend(Object value)
          Prepends the string evaluation of this expression with the given value
 Predicate regex(String regex)
          Creates a predicate which is true if this expression matches the given regular expression
 ValueBuilder regexReplaceAll(String regex, Expression replacement)
          Replaces all occurrences of the regular expression with the given replacement
 ValueBuilder regexReplaceAll(String regex, String replacement)
          Replaces all occurrences of the regular expression with the given replacement
 ValueBuilder regexTokenize(String regex)
          Tokenizes the string conversion of this expression using the given regular expression
 ValueBuilder sort(Comparator<?> comparator)
          Sorts the current value using the given comparator.
 Predicate startsWith(Object value)
           
 ValueBuilder tokenize()
           
 ValueBuilder 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 expression)
Method Detail

evaluate

public <T> T evaluate(Exchange exchange,
                      Class<T> type)
Description copied from interface: Expression
Returns the value of the expression on the given exchange

Specified by:
evaluate in interface Expression
Parameters:
exchange - the message exchange on which to evaluate the expression
type - the expected type of the evaluation result
Returns:
the value of the expression

getExpression

public Expression getExpression()

toString

public String toString()
Overrides:
toString in class Object

matches

public Predicate matches(Expression expression)

matches

public ExpressionClause<Predicate> matches()

isNotEqualTo

public Predicate isNotEqualTo(Object value)

isEqualTo

public Predicate isEqualTo(Object value)

isLessThan

public Predicate isLessThan(Object value)

isLessThanOrEqualTo

public Predicate isLessThanOrEqualTo(Object value)

isGreaterThan

public Predicate isGreaterThan(Object value)

isGreaterThanOrEqualTo

public Predicate isGreaterThanOrEqualTo(Object value)

isInstanceOf

public Predicate isInstanceOf(Class<?> type)

isNull

public Predicate isNull()

isNotNull

public Predicate isNotNull()

not

public Predicate not(Predicate predicate)

in

public Predicate in(Object... values)

in

public Predicate in(Predicate... predicates)

startsWith

public Predicate startsWith(Object value)

endsWith

public Predicate endsWith(Object value)

contains

public Predicate 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 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 tokenize()

tokenize

public ValueBuilder tokenize(String token)

regexTokenize

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


regexReplaceAll

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


regexReplaceAll

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


convertTo

public ValueBuilder 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 convertToString()
Converts the current value to a String using the registered type converters

Returns:
the current builder

append

public ValueBuilder 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

prepend

public ValueBuilder prepend(Object value)
Prepends the string evaluation of this expression with the given value

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

sort

public ValueBuilder sort(Comparator<?> comparator)
Sorts the current value using the given comparator. The current value must be convertable to a List to allow sorting using the comparator.

Parameters:
comparator - the comparator used by sorting
Returns:
the current builder

onNewPredicate

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


asExpression

protected Expression asExpression(Object value)


Apache CAMEL