org.apache.camel.builder
Class ExpressionBuilder

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

public final class ExpressionBuilder
extends Object

A helper class for working with expressions.

Version:
$Revision: 775452 $

Method Summary
static
<E extends Exchange>
Expression<E>
append(Expression<E> left, Expression<E> right)
          Appends the String evaluations of the two expressions together
static
<E extends Exchange>
Expression<E>
beanExpression(String bean)
           
static
<E extends Exchange>
Expression<E>
bodyExpression()
          Returns the expression for the exchanges inbound message body
static
<E extends Exchange,T>
Expression<E>
bodyExpression(Class<T> type)
          Returns the expression for the exchanges inbound message body converted to the given type
static
<E extends Exchange>
Expression<E>
camelContextPropertiesExpression()
          Returns an expression for the properties of exchange with the given name
static
<E extends Exchange>
Expression<E>
camelContextPropertyExpression(String propertyName)
          Returns an expression for the property value of the camel context with the given name
static
<E extends Exchange>
Expression<E>
concatExpression(Collection<Expression> expressions)
          Returns an expression which returns the string concatenation value of the various expressions
static
<E extends Exchange>
Expression<E>
concatExpression(Collection<Expression> expressions, String expression)
          Returns an expression which returns the string concatenation value of the various expressions
static
<E extends Exchange>
Expression<E>
constantExpression(Object value)
          Returns an expression for the constant value
static
<E extends Exchange>
Expression<E>
convertTo(Expression expression, Class type)
          Returns an expression which converts the given expression to the given type
static
<E extends Exchange>
Expression<E>
dateExpression(String command, String pattern)
           
static
<E extends Exchange>
String
evaluateStringExpression(Expression<E> expression, E exchange)
          Evaluates the expression on the given exchange and returns the String representation
static
<E extends Exchange>
Expression<E>
exchangeExpression()
          Returns the expression for the exchange
static
<E extends Exchange>
Expression<E>
faultBodyExpression()
          Returns the expression for the fault messages body
static
<E extends Exchange,T>
Expression<E>
faultBodyExpression(Class<T> type)
          Returns the expression for the exchanges fault message body converted to the given type
static
<E extends Exchange>
Expression<E>
headerExpression(String headerName)
          Returns an expression for the header value with the given name
static
<E extends Exchange>
Expression<E>
headersExpression()
          Returns an expression for the inbound message headers
static
<E extends Exchange>
Expression<E>
inMessageExpression()
          Returns the expression for the IN message
static
<E extends Exchange>
Expression<E>
messageIdExpression()
          Returns an Expression for the inbound message id
static
<E extends Exchange>
Expression<E>
outBodyExpression()
          Returns the expression for the out messages body
static
<E extends Exchange,T>
Expression<E>
outBodyExpression(Class<T> type)
          Returns the expression for the exchanges outbound message body converted to the given type
static
<E extends Exchange>
Expression<E>
outHeaderExpression(String headerName)
          Returns an expression for the out header value with the given name
static
<E extends Exchange>
Expression<E>
outHeadersExpression()
          Returns an expression for the outbound message headers
static
<E extends Exchange>
Expression<E>
outMessageExpression()
          Returns the expression for the OUT message
static
<E extends Exchange>
Expression<E>
propertiesExpression()
          Returns an expression for the properties of exchange with the given name
static
<E extends Exchange>
Expression<E>
propertyExpression(String propertyName)
          Returns an expression for the property value of exchange with the given name
static
<E extends Exchange>
Expression<E>
regexReplaceAll(Expression<E> expression, String regex, Expression<E> replacementExpression)
          Transforms the expression into a String then performs the regex replaceAll to transform the String and return the result
static
<E extends Exchange>
Expression<E>
regexReplaceAll(Expression<E> expression, String regex, String replacement)
          Transforms the expression into a String then performs the regex replaceAll to transform the String and return the result
static
<E extends Exchange>
Expression<E>
regexTokenize(Expression<E> expression, String regexTokenizer)
          Returns a tokenize expression which will tokenize the string with the given regex
static
<E extends Exchange>
Expression<E>
simpleExpression(String simple)
           
static
<E extends Exchange>
Expression<E>
systemProperty(String name)
          Returns an expression for the given system property
static
<E extends Exchange>
Expression<E>
systemProperty(String name, String defaultValue)
          Returns an expression for the given system property
static
<E extends Exchange>
Expression<E>
systemPropertyExpression(String propertyName)
          Returns an expression for a system property value with the given name
static
<E extends Exchange>
Expression<E>
systemPropertyExpression(String propertyName, String defaultValue)
          Returns an expression for a system property value with the given name
static
<E extends Exchange>
Expression<E>
tokenizeExpression(Expression<E> expression, String token)
          Returns a tokenize expression which will tokenize the string with the given token
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

headerExpression

public static <E extends Exchange> Expression<E> headerExpression(String headerName)
Returns an expression for the header value with the given name

Parameters:
headerName - the name of the header the expression will return
Returns:
an expression object which will return the header value

headersExpression

public static <E extends Exchange> Expression<E> headersExpression()
Returns an expression for the inbound message headers

Returns:
an expression object which will return the inbound headers
See Also:
Message.getHeaders()

outHeaderExpression

public static <E extends Exchange> Expression<E> outHeaderExpression(String headerName)
Returns an expression for the out header value with the given name

Parameters:
headerName - the name of the header the expression will return
Returns:
an expression object which will return the header value

outHeadersExpression

public static <E extends Exchange> Expression<E> outHeadersExpression()
Returns an expression for the outbound message headers

Returns:
an expression object which will return the inbound headers
See Also:
Message.getHeaders()

propertyExpression

public static <E extends Exchange> Expression<E> propertyExpression(String propertyName)
Returns an expression for the property value of exchange with the given name

Parameters:
propertyName - the name of the property the expression will return
Returns:
an expression object which will return the property value
See Also:
Exchange.getProperty(String)

propertiesExpression

public static <E extends Exchange> Expression<E> propertiesExpression()
Returns an expression for the properties of exchange with the given name

Returns:
an expression object which will return the properties
See Also:
Exchange.getProperties()

camelContextPropertiesExpression

public static <E extends Exchange> Expression<E> camelContextPropertiesExpression()
Returns an expression for the properties of exchange with the given name

Returns:
an expression object which will return the properties
See Also:
Exchange.getProperties()

camelContextPropertyExpression

public static <E extends Exchange> Expression<E> camelContextPropertyExpression(String propertyName)
Returns an expression for the property value of the camel context with the given name

Parameters:
propertyName - the name of the property the expression will return
Returns:
an expression object which will return the property value
See Also:
Exchange.getProperty(String)

systemPropertyExpression

public static <E extends Exchange> Expression<E> systemPropertyExpression(String propertyName)
Returns an expression for a system property value with the given name

Parameters:
propertyName - the name of the system property the expression will return
Returns:
an expression object which will return the system property value

systemPropertyExpression

public static <E extends Exchange> Expression<E> systemPropertyExpression(String propertyName,
                                                                          String defaultValue)
Returns an expression for a system property value with the given name

Parameters:
propertyName - the name of the system property the expression will return
Returns:
an expression object which will return the system property value

constantExpression

public static <E extends Exchange> Expression<E> constantExpression(Object value)
Returns an expression for the constant value

Parameters:
value - the value the expression will return
Returns:
an expression object which will return the constant value

bodyExpression

public static <E extends Exchange> Expression<E> bodyExpression()
Returns the expression for the exchanges inbound message body


bodyExpression

public static <E extends Exchange,T> Expression<E> bodyExpression(Class<T> type)
Returns the expression for the exchanges inbound message body converted to the given type


outBodyExpression

public static <E extends Exchange> Expression<E> outBodyExpression()
Returns the expression for the out messages body


outBodyExpression

public static <E extends Exchange,T> Expression<E> outBodyExpression(Class<T> type)
Returns the expression for the exchanges outbound message body converted to the given type


faultBodyExpression

public static <E extends Exchange> Expression<E> faultBodyExpression()
Returns the expression for the fault messages body


faultBodyExpression

public static <E extends Exchange,T> Expression<E> faultBodyExpression(Class<T> type)
Returns the expression for the exchanges fault message body converted to the given type


exchangeExpression

public static <E extends Exchange> Expression<E> exchangeExpression()
Returns the expression for the exchange


inMessageExpression

public static <E extends Exchange> Expression<E> inMessageExpression()
Returns the expression for the IN message


outMessageExpression

public static <E extends Exchange> Expression<E> outMessageExpression()
Returns the expression for the OUT message


convertTo

public static <E extends Exchange> Expression<E> convertTo(Expression expression,
                                                           Class type)
Returns an expression which converts the given expression to the given type


tokenizeExpression

public static <E extends Exchange> Expression<E> tokenizeExpression(Expression<E> expression,
                                                                    String token)
Returns a tokenize expression which will tokenize the string with the given token


regexTokenize

public static <E extends Exchange> Expression<E> regexTokenize(Expression<E> expression,
                                                               String regexTokenizer)
Returns a tokenize expression which will tokenize the string with the given regex


regexReplaceAll

public static <E extends Exchange> Expression<E> regexReplaceAll(Expression<E> expression,
                                                                 String regex,
                                                                 String replacement)
Transforms the expression into a String then performs the regex replaceAll to transform the String and return the result


regexReplaceAll

public static <E extends Exchange> Expression<E> regexReplaceAll(Expression<E> expression,
                                                                 String regex,
                                                                 Expression<E> replacementExpression)
Transforms the expression into a String then performs the regex replaceAll to transform the String and return the result


append

public static <E extends Exchange> Expression<E> append(Expression<E> left,
                                                        Expression<E> right)
Appends the String evaluations of the two expressions together


evaluateStringExpression

public static <E extends Exchange> String evaluateStringExpression(Expression<E> expression,
                                                                   E exchange)
Evaluates the expression on the given exchange and returns the String representation

Parameters:
expression - the expression to evaluate
exchange - the exchange to use to evaluate the expression
Returns:
the String representation of the expression or null if it could not be evaluated

systemProperty

public static <E extends Exchange> Expression<E> systemProperty(String name)
Returns an expression for the given system property


systemProperty

public static <E extends Exchange> Expression<E> systemProperty(String name,
                                                                String defaultValue)
Returns an expression for the given system property


concatExpression

public static <E extends Exchange> Expression<E> concatExpression(Collection<Expression> expressions)
Returns an expression which returns the string concatenation value of the various expressions

Parameters:
expressions - the expression to be concatenated dynamically
Returns:
an expression which when evaluated will return the concatenated values

concatExpression

public static <E extends Exchange> Expression<E> concatExpression(Collection<Expression> expressions,
                                                                  String expression)
Returns an expression which returns the string concatenation value of the various expressions

Parameters:
expressions - the expression to be concatenated dynamically
expression - the text description of the expression
Returns:
an expression which when evaluated will return the concatenated values

messageIdExpression

public static <E extends Exchange> Expression<E> messageIdExpression()
Returns an Expression for the inbound message id


dateExpression

public static <E extends Exchange> Expression<E> dateExpression(String command,
                                                                String pattern)

simpleExpression

public static <E extends Exchange> Expression<E> simpleExpression(String simple)

beanExpression

public static <E extends Exchange> Expression<E> beanExpression(String bean)


Apache CAMEL