* @throws ExpressionRuntimeException if the expression is invalid, or a null is found for the expression and
* 'failIfNull is set to true.
*/
public Object evaluate(String expression, String evaluator, MuleMessage message, boolean failIfNull) throws ExpressionRuntimeException
{
ExpressionEvaluator extractor = (ExpressionEvaluator) evaluators.get(evaluator);
if (extractor == null)
{
throw new IllegalArgumentException(CoreMessages.expressionEvaluatorNotRegistered(evaluator).getMessage());
}
Object result = extractor.evaluate(expression, message);
//TODO Handle empty collections || (result instanceof Collection && ((Collection)result).size()==0)
if (failIfNull && (result == null))
{
throw new RequiredValueException(CoreMessages.expressionEvaluatorReturnedNull(evaluator, expression));
}