【问题标题】:How can I convert an Exchange property to uppercase in 'simple'?如何在“简单”中将 Exchange 属性转换为大写?
【发布时间】:2015-02-19 15:15:48
【问题描述】:

如何将 Apache Camel Exchange 上的属性转换为 Apache Camel 表达式语言中的大写?

例如

.when(simple("${property.countryCode.toUpperCase} regex 'NO?'"))

但我得到了:

org.apache.camel.language.bean.RuntimeBeanExpressionException:
Failed to invoke method: .toUpperCase on null

我已通过.log("${property.countryCode}") 验证我的财产确实存在。

在 Apache Simple 中获取 toUpperCase 应该不难(但确实如此)。

我不想在 Java、Groovy 或其他任何语言中使用 toUpperCase - 必须有更简单的方法

【问题讨论】:

  • 不能选择不区分大小写的正则表达式?
  • 是的,但是有点乱。如果我理解正确的话,这种情况下的正则表达式是([Nn][Oo])?。此外,还有其他情况我想转换为大写。顺便说一句,我的属性来自一个 xpath 表达式,但是 apache camel 不支持开箱即用的 XPath 2.0(和 upper-case() 函数)......

标签: java apache-camel simple-el


【解决方案1】:

试试

.when(simple("${property.countryCode.toUpperCase()} regex 'NO?'"))

【讨论】:

    猜你喜欢
    • 2013-07-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-07-28
    • 1970-01-01
    • 2019-02-26
    • 1970-01-01
    • 2017-10-17
    相关资源
    最近更新 更多