In short, no it shouldn't be changed. Take a look at the implementation and
you'll see why. A few things to keep in mind:

  1) The toString() implementation you're implicitly calling is coming from
the underlying org.apache.activemq.artemis.selector.filter.UnaryExpression
instance so it doesn't have details about the java.util.regex.Pattern from
org.apache.activemq.artemis.selector.filter.ComparisonExpression.LikeExpression.
If you were to override toString() in LikeExpression and include the
Pattern details it would make more sense when you print it.
  2) If you actually evaluate proper 'like' expressions they work as
expected.
  3) The '?' character has no special meaning in the filter syntax. You
probably want to use "a like 'abc%'" instead, but that's just a guess. The
filter language is based on a subset of the SQL 92 expression syntax. It is
the same as the syntax used for JMS selectors, but the predefined
identifiers are different. For documentation on JMS selector syntax please
the JMS javadoc for javax.jms.Message [1].


Justin

[1] https://javaee.github.io/javaee-spec/javadocs/javax/jms/Message.html

On Fri, Dec 28, 2018 at 6:58 AM Oliver B. Fischer <[email protected]>
wrote:

> Dear all,
>
> in a special use case I have to analyze a selector by my own. In doing
> so I stumpled on the like expression. Here is a snippet from my tests:
>
>      SelectorParser sp = new SelectorParser();
>      Expression expression = sp.parse("a like 'abc?'");
>
>      System.out.println(expression);
>
> The output of this code is "(like a)" and expression is an instance of
> org.apache.activemq.artemis.selector.filter.ComparisonExpression$LikeExpression
>
> and extends UnaryExpression.
>
> IMHO the output should be "(a like _pattern_)" and the like expression
> should be an BinaryExpression.
>
> Shouldn't it be changed?
>
> Oliver
>
>
> --
> N Oliver B. Fischer
> A Schönhauser Allee 64, 10437 Berlin, Deutschland/Germany
> P +49 30 44793251
> M +49 178 7903538
> E [email protected]
> S oliver.b.fischer
> J [email protected]
> X http://xing.to/obf
>

Reply via email to