0

I have a string

((effectiveDate >= "11/01/2015") and (effectiveDate < "04/30/2016")) and (not ((name like "*John*")) and (name like "*Smith*") and (age > "20"))

After I convert it to an expression it is not maintaining the parenthesis order

    Expression exp = Expression.fromString(origExpStr);
    System.out.println(exp);

This is resulting in

(effectiveDate >= "11/01/2015") and (effectiveDate < "04/30/2016") and not ((name like "*John*")) and (name like "*Smith*") and (age > "20")

Logically it could mean the same but I would like to maintain the parenthesis order to maintain the proper grouping.

Is there a way to maintain parenthesis order after converting to an Expression

1 Answers1

0

Cayenne Expression.toString() would generate a minimally valid expression that does not alter the order of operands. So it will result in its own parenthesis style that may or may not match the original set of parenthesis. Exactly as you observed.

andrus_a
  • 2,528
  • 1
  • 16
  • 10