Package org.apache.activemq.artemis.selector.filter

## Class ComparisonExpression

- java.lang.Object
- - org.apache.activemq.artemis.selector.filter.BinaryExpression
  - - org.apache.activemq.artemis.selector.filter.ComparisonExpression

- All Implemented Interfaces:
    `BooleanExpression`, `Expression`

      public abstract class ComparisonExpression
      extends BinaryExpression
      implements BooleanExpression

  A filter performing a comparison of two objects
  Version:
    $Revision: 1.2 $

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static java.lang.ThreadLocal<java.lang.Boolean>` | `CONVERT_STRING_EXPRESSIONS` |

    - ### Fields inherited from class org.apache.activemq.artemis.selector.filter.BinaryExpression

      `left, right`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `ComparisonExpression​(Expression left, Expression right)` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `protected abstract boolean` | `asBoolean​(int answer)` |
    `static void` | `checkEqualOperand​(Expression expr)` | Validates that the expression can be used in `==` or `<>` expression.
    `static void` | `checkLessThanOperand​(Expression expr)` | Only Numeric expressions can be used in `>`, `>=`, `<` or `<=` expressions.
    `protected java.lang.Boolean` | `compare​(java.lang.Comparable lv, java.lang.Comparable rv)` |
    `static BooleanExpression` | `createBetween​(Expression value, Expression left, Expression right)` |
    `static BooleanExpression` | `createEqual​(Expression left, Expression right)` |
    `static BooleanExpression` | `createGreaterThan​(Expression left, Expression right)` |
    `static BooleanExpression` | `createGreaterThanEqual​(Expression left, Expression right)` |
    `static BooleanExpression` | `createInFilter​(Expression left, java.util.List<java.lang.Object> elements)` |
    `static BooleanExpression` | `createIsNotNull​(Expression left)` |
    `static BooleanExpression` | `createIsNull​(Expression left)` |
    `static BooleanExpression` | `createLessThan​(Expression left, Expression right)` |
    `static BooleanExpression` | `createLessThanEqual​(Expression left, Expression right)` |
    `static BooleanExpression` | `createLike​(Expression left, java.lang.String right, java.lang.String escape)` |
    `static BooleanExpression` | `createNotBetween​(Expression value, Expression left, Expression right)` |
    `static BooleanExpression` | `createNotEqual​(Expression left, Expression right)` |
    `static BooleanExpression` | `createNotInFilter​(Expression left, java.util.List<java.lang.Object> elements)` |
    `static BooleanExpression` | `createNotLike​(Expression left, java.lang.String right, java.lang.String escape)` |
    `java.lang.Object` | `evaluate​(Filterable message)` |
    `boolean` | `matches​(Filterable message)` |

    - ### Methods inherited from class org.apache.activemq.artemis.selector.filter.BinaryExpression

      `equals, getExpressionSymbol, getLeft, getRight, hashCode, setLeft, setRight, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### CONVERT_STRING_EXPRESSIONS

          public static final java.lang.ThreadLocal<java.lang.Boolean> CONVERT_STRING_EXPRESSIONS

  - ### Constructor Detail

    - #### ComparisonExpression

          public ComparisonExpression​(Expression left,
                                      Expression right)

      Parameters:
        `left` -
        `right` -

  - ### Method Detail

    - #### createBetween

          public static BooleanExpression createBetween​(Expression value,
                                                        Expression left,
                                                        Expression right)

    - #### createNotBetween

          public static BooleanExpression createNotBetween​(Expression value,
                                                           Expression left,
                                                           Expression right)

    - #### createLike

          public static BooleanExpression createLike​(Expression left,
                                                     java.lang.String right,
                                                     java.lang.String escape)

    - #### createNotLike

          public static BooleanExpression createNotLike​(Expression left,
                                                        java.lang.String right,
                                                        java.lang.String escape)

    - #### createInFilter

          public static BooleanExpression createInFilter​(Expression left,
                                                         java.util.List<java.lang.Object> elements)

    - #### createNotInFilter

          public static BooleanExpression createNotInFilter​(Expression left,
                                                            java.util.List<java.lang.Object> elements)

    - #### createIsNull

          public static BooleanExpression createIsNull​(Expression left)

    - #### createIsNotNull

          public static BooleanExpression createIsNotNull​(Expression left)

    - #### createNotEqual

          public static BooleanExpression createNotEqual​(Expression left,
                                                         Expression right)

    - #### createEqual

          public static BooleanExpression createEqual​(Expression left,
                                                      Expression right)

    - #### createGreaterThan

          public static BooleanExpression createGreaterThan​(Expression left,
                                                            Expression right)

    - #### createGreaterThanEqual

          public static BooleanExpression createGreaterThanEqual​(Expression left,
                                                                 Expression right)

    - #### createLessThan

          public static BooleanExpression createLessThan​(Expression left,
                                                         Expression right)

    - #### createLessThanEqual

          public static BooleanExpression createLessThanEqual​(Expression left,
                                                              Expression right)

    - #### checkLessThanOperand

          public static void checkLessThanOperand​(Expression expr)

      Only Numeric expressions can be used in `>`, `>=`, `<` or `<=` expressions.
      Parameters:
        `expr` -

    - #### checkEqualOperand

          public static void checkEqualOperand​(Expression expr)

      Validates that the expression can be used in `==` or `<>` expression. Cannot not be NULL TRUE or FALSE literals.
      Parameters:
        `expr` -

    - #### evaluate

          public java.lang.Object evaluate​(Filterable message)
                                    throws FilterException

      Specified by:
        `evaluate` in interface `Expression`
      Returns:
        the value of this expression
      Throws:
        `FilterException`

    - #### compare

          protected java.lang.Boolean compare​(java.lang.Comparable lv,
                                              java.lang.Comparable rv)

    - #### asBoolean

          protected abstract boolean asBoolean​(int answer)

    - #### matches

          public boolean matches​(Filterable message)
                          throws FilterException

      Specified by:
        `matches` in interface `BooleanExpression`
      Returns:
        true if the expression evaluates to Boolean.TRUE.
      Throws:
        `FilterException`