0

I am using spring integration in my project. I need to verify if one of the nodes value in my response contains a string by ignoring case sensitivity. I have to see if the databaseName value contains DB2 by ignoring case sensitivity.

I am using the following expression to verify, but it's not working.

expression="T(java.util.regex.Pattern).compile(T(java.util.regex.Pattern).quote('DB2'), T(java.util.regex.Pattern).CASE_INSENSITIVE).matcher(#xpath(payload, '//databaseName')).find()"

I referred the following links before framing my expression:

https://docs.spring.io/spring/docs/current/spring-framework-reference/html/expressions.html

How to call a method of a class from expression in spring Integration

How to check if a String contains another String in a case insensitive manner in Java?

Am I missing anything in the expression?

Community
  • 1
  • 1
Ashok.N
  • 1,327
  • 9
  • 29
  • 64
  • 1
    what's wrong with `#xpath(payload, '//databaseName').toLowerCase().contains("db2")` ? – Gary Russell Mar 30 '17 at 13:03
  • Yep! Thanks for the response. It works... But I wanted to give a try with other approach. I was just curious to learn using the java methods by typeReference. – Ashok.N Mar 30 '17 at 13:43

1 Answers1

0

As per Gary Russell's suggestion, The following expression worked for me.

#xpath(payload, '//databaseName').toLowerCase().contains('db2')
Ashok.N
  • 1,327
  • 9
  • 29
  • 64