apache骆驼简单表达式没有给出字符串值

2022-01-19 00:00:00 java apache-camel simple-el

我正在使用 apache 骆驼.我正在尝试使用简单的表达式语言从正文中检索值.我需要它作为字符串,但简单返回 SimpleBuilder 对象.所以我尝试过这样的事情

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()

但它返回给我 java.lang.String.请告诉我如何才能将这个表达式的结果作为字符串?

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

推荐答案

那只是为了配置简单的表达式.如果你需要评估它然后调用评估方法

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);

相关文章