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: 788778 $

Method Summary
static Expression append(Expression left, Expression right)
          Appends the String evaluations of the two expressions together
static Expression beanExpression(Class beanType, String methodName)
           
static Expression beanExpression(String expression)
           
static Expression beanExpression(String beanRef, String methodName)
           
static Expression bodyExpression()
          Returns the expression for the exchanges inbound message body
static
<T> Expression
bodyExpression(Class<T> type)
          Returns the expression for the exchanges inbound message body converted to the given type
static Expression bodyTypeExpression()
          Returns the expression for the exchanges inbound message body type
static Expression camelContextExpression()
          Returns an expression for the CamelContext
static Expression camelContextPropertiesExpression()
          Returns an expression for the properties of the camel context
static Expression camelContextPropertyExpression(String propertyName)
          Returns an expression for the property value of the camel context with the given name
static Expression concatExpression(Collection<Expression> expressions)
          Returns an expression which returns the string concatenation value of the various expressions
static Expression concatExpression(Collection<Expression> expressions, String expression)
          Returns an expression which returns the string concatenation value of the various expressions
static Expression constantExpression(Object value)
          Returns an expression for the constant value
static Expression convertToExpression(Expression expression, Class type)
          Returns an expression which converts the given expression to the given type
static Expression convertToExpression(Expression expression, Expression type)
          Returns an expression which converts the given expression to the given type the type expression is evaluted to
static Expression dateExpression(String command, String pattern)
           
static Expression exchangeExceptionExpression()
          Returns an expression for an exception set on the exchange
static Expression exchangeExceptionExpression(Class<Exception> type)
          Returns an expression for an exception set on the exchange

Is used to get the caused exception that typically have been wrapped in some sort of Camel wrapper exception

static Expression exchangeExceptionMessageExpression()
          Returns an expression for an exception message set on the exchange
static Expression exchangeExpression()
          Returns the expression for the exchange
static Expression faultBodyExpression()
          Returns the expression for the fault messages body
static
<T> Expression
faultBodyExpression(Class<T> type)
          Returns the expression for the exchanges fault message body converted to the given type
static Expression headerExpression(String headerName)
          Returns an expression for the header value with the given name
static Expression headersExpression()
          Returns an expression for the inbound message headers
static Expression inMessageExpression()
          Returns the expression for the IN message
static Expression messageIdExpression()
          Returns an Expression for the inbound message id
static Expression outBodyExpression()
          Returns the expression for the out messages body
static
<T> Expression
outBodyExpression(Class<T> type)
          Returns the expression for the exchanges outbound message body converted to the given type
static Expression outHeaderExpression(String headerName)
          Returns an expression for the out header value with the given name
static Expression outHeadersExpression()
          Returns an expression for the outbound message headers
static Expression outMessageExpression()
          Returns the expression for the OUT message
static Expression prepend(Expression left, Expression right)
          Prepends the String evaluations of the two expressions together
static Expression propertiesExpression()
          Returns an expression for the properties of exchange
static Expression propertyExpression(String propertyName)
          Returns an expression for the property value of exchange with the given name
static Expression regexReplaceAll(Expression expression, String regex, Expression replacementExpression)
          Transforms the expression into a String then performs the regex replaceAll to transform the String and return the result
static Expression regexReplaceAll(Expression 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 Expression regexTokenizeExpression(Expression expression, String regexTokenizer)
          Returns a tokenize expression which will tokenize the string with the given regex
static Expression registryExpression()
          Returns an expression for the Registry
static Expression simpleExpression(String expression)
           
static Expression sortExpression(Expression expression, Comparator comparator)
          Returns a sort expression which will sort the expression with the given comparator.
static Expression systemPropertyExpression(String propertyName)
          Returns an expression for a system property value with the given name
static Expression systemPropertyExpression(String propertyName, String defaultValue)
          Returns an expression for a system property value with the given name
static Expression toExpression(String uri)
          Returns an expression processing the exchange to the given endpoint uri
static Expression tokenizeExpression(Expression expression, String token)
          Returns a tokenize expression which will tokenize the string with the given token
static Expression typeConverterExpression()
          Returns an expression for the type converter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

headerExpression

public static Expression 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 Expression headersExpression()
Returns an expression for the inbound message headers

Returns:
an expression object which will return the inbound headers

outHeaderExpression

public static Expression 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 Expression outHeadersExpression()
Returns an expression for the outbound message headers

Returns:
an expression object which will return the headers

exchangeExceptionExpression

public static Expression exchangeExceptionExpression()
Returns an expression for an exception set on the exchange

Returns:
an expression object which will return the exception set on the exchange
See Also:
Exchange.getException()

exchangeExceptionExpression

public static Expression exchangeExceptionExpression(Class<Exception> type)
Returns an expression for an exception set on the exchange

Is used to get the caused exception that typically have been wrapped in some sort of Camel wrapper exception

Parameters:
type - the exception type
Returns:
an expression object which will return the exception set on the exchange
See Also:
Exchange.getException(Class)

typeConverterExpression

public static Expression typeConverterExpression()
Returns an expression for the type converter

Returns:
an expression object which will return the type converter

registryExpression

public static Expression registryExpression()
Returns an expression for the Registry

Returns:
an expression object which will return the registry

camelContextExpression

public static Expression camelContextExpression()
Returns an expression for the CamelContext

Returns:
an expression object which will return the camel context

exchangeExceptionMessageExpression

public static Expression exchangeExceptionMessageExpression()
Returns an expression for an exception message set on the exchange

Returns:
an expression object which will return the exception message set on the exchange
See Also:
Exchange.getException().getMessage()

propertyExpression

public static Expression 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

propertiesExpression

public static Expression propertiesExpression()
Returns an expression for the properties of exchange

Returns:
an expression object which will return the properties

camelContextPropertiesExpression

public static Expression camelContextPropertiesExpression()
Returns an expression for the properties of the camel context

Returns:
an expression object which will return the properties

camelContextPropertyExpression

public static Expression 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

systemPropertyExpression

public static Expression 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 Expression 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
defaultValue - default value to return if no system property exists
Returns:
an expression object which will return the system property value

constantExpression

public static Expression 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 Expression bodyExpression()
Returns the expression for the exchanges inbound message body


bodyExpression

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


bodyTypeExpression

public static Expression bodyTypeExpression()
Returns the expression for the exchanges inbound message body type


outBodyExpression

public static Expression outBodyExpression()
Returns the expression for the out messages body


outBodyExpression

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


faultBodyExpression

public static Expression faultBodyExpression()
Returns the expression for the fault messages body


faultBodyExpression

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


exchangeExpression

public static Expression exchangeExpression()
Returns the expression for the exchange


inMessageExpression

public static Expression inMessageExpression()
Returns the expression for the IN message


outMessageExpression

public static Expression outMessageExpression()
Returns the expression for the OUT message


convertToExpression

public static Expression convertToExpression(Expression expression,
                                             Class type)
Returns an expression which converts the given expression to the given type


convertToExpression

public static Expression convertToExpression(Expression expression,
                                             Expression type)
Returns an expression which converts the given expression to the given type the type expression is evaluted to


tokenizeExpression

public static Expression tokenizeExpression(Expression expression,
                                            String token)
Returns a tokenize expression which will tokenize the string with the given token


regexTokenizeExpression

public static Expression regexTokenizeExpression(Expression expression,
                                                 String regexTokenizer)
Returns a tokenize expression which will tokenize the string with the given regex


sortExpression

public static Expression sortExpression(Expression expression,
                                        Comparator comparator)
Returns a sort expression which will sort the expression with the given comparator.

The expression is evaluted as a List object to allow sorting.


regexReplaceAll

public static Expression regexReplaceAll(Expression 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 Expression regexReplaceAll(Expression expression,
                                         String regex,
                                         Expression replacementExpression)
Transforms the expression into a String then performs the regex replaceAll to transform the String and return the result


append

public static Expression append(Expression left,
                                Expression right)
Appends the String evaluations of the two expressions together


prepend

public static Expression prepend(Expression left,
                                 Expression right)
Prepends the String evaluations of the two expressions together


concatExpression

public static Expression 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 Expression 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 Expression messageIdExpression()
Returns an Expression for the inbound message id


dateExpression

public static Expression dateExpression(String command,
                                        String pattern)

simpleExpression

public static Expression simpleExpression(String expression)

beanExpression

public static Expression beanExpression(String expression)

beanExpression

public static Expression beanExpression(Class beanType,
                                        String methodName)

beanExpression

public static Expression beanExpression(String beanRef,
                                        String methodName)

toExpression

public static Expression toExpression(String uri)
Returns an expression processing the exchange to the given endpoint uri

Parameters:
uri - endpoint uri to send the exchange to
Returns:
an expression object which will return the OUT body


Apache CAMEL