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

查看:84
本文介绍了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.请告诉我如何获取此表达式的结果为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天全站免登陆