骆驼简单表达式中的三元运算符

时间:2020-10-16 07:53:18

标签: apache-camel talend

使用此处描述的三元运算符逻辑 http://www.davsclaus.com/2011/09/camel-29-much-improved-simple-language.html

我试图像这样设置一个名为StatusMsg2的交换属性,其中 exchangeProperty.StatusMsg ='abc'

.setProperty("StatusMsg2")
.simple("${exchangeProperty.StatusMsg} == null ? 'ee2e2e2' : 'fffffff'")

将StatusMsg2设置为字符串

abc == null ? 'ee2e2e2' : 'fffffff'

作为值,而不是对表达式求值。

我正在使用骆驼2.29,尽管在Talend Studio中。但是Talend按照我的输出渲染了普通的骆驼。

我已经检查了我的空格是否正确

如果我替换为

.simple("true ? 'ee2e2e2' : 'fffffff'")

我得到了字符串

true ? 'ee2e2e2' : 'fffffff'

如果我愿意

simple(true ? "ee2e2e2" : "fffffff")

然后我得到了字符串

ee2e2e2

如果我尝试

.simple("${exchangeProperty.StatusMsg} == null" ? "ee2e2e2" : "fffffff")

我收到“类型不匹配:无法从字符串转换为布尔值”的编译错误

如何识别三元表达式的第一部分 作为表达本身?

谢谢您的建议

n

0 个答案:

没有答案