Search code examples
javaapache-camelsimple-el

apache camel simple expression not giving string value


I am using apache camel. I am trying to retrieve value from body using simple expression language. I need it as a String but simple returns SimpleBuilder object. So I have tried something like this

simple("${body.address.line}").resultType(String.class).getResultType()

but it is returning me java.lang.String. please tell me how can I get this expression's result as String?


Solution

  • That is only for configuring the simple expression. If you need to evaluate it then call the evaluate method

    String foo = simple("${body.address.line}").evaluate(exchange, String.class);