apache骆驼简单表达式没有给出字符串值 [英] apache camel simple expression not giving string value

查看:18
本文介绍了apache骆驼简单表达式没有给出字符串值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 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);

这篇关于apache骆驼简单表达式没有给出字符串值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆