if (!getReturnClass().isInstance(result))
{
//If the return type does not match, lets attempt to transform it before throwing an error
try
{
Transformer t = muleContext.getRegistry().lookupTransformer(
DataTypeFactory.createFromObject(result), DataTypeFactory.create(getReturnClass()));
result = t.transform(result);
}
catch (TransformerException e)
{
throw new ExpressionRuntimeException(CoreMessages.transformUnexpectedType(result.getClass(),
getReturnClass()), e);