org.apache.camel.util
Class ExpressionHelper

java.lang.Object
  extended by org.apache.camel.util.ExpressionHelper

public final class ExpressionHelper
extends Object

A collection of helper methods for working with expressions.

Version:
$Revision: 687515 $

Method Summary
static
<E extends Exchange>
String
evaluateAsString(Expression<E> expression, E exchange)
          Evaluates the given expression on the exchange as a String value
static
<T,E extends Exchange>
T
evaluateAsType(Expression<E> expression, E exchange, Class<T> resultType)
          Evaluates the given expression on the exchange, converting the result to the given type
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

evaluateAsString

public static <E extends Exchange> String evaluateAsString(Expression<E> expression,
                                                           E exchange)
Evaluates the given expression on the exchange as a String value

Parameters:
expression - the expression to evaluate
exchange - the exchange to use to evaluate the expression
Returns:
the result of the evaluation as a string.

evaluateAsType

public static <T,E extends Exchange> T evaluateAsType(Expression<E> expression,
                                                      E exchange,
                                                      Class<T> resultType)
Evaluates the given expression on the exchange, converting the result to the given type

Parameters:
expression - the expression to evaluate
exchange - the exchange to use to evaluate the expression
resultType - the type of the result that is required
Returns:
the result of the evaluation as the specified type.


Apache CAMEL