org.apache.commons.jexl3

## Enum JexlOperator

- java.lang.Object
- - java.lang.Enum<JexlOperator>
  - - org.apache.commons.jexl3.JexlOperator

- All Implemented Interfaces:
    Serializable, Comparable<JexlOperator>

      public enum JexlOperator
      extends Enum<JexlOperator>

  The JEXL operators. These are the operators that are executed by JexlArithmetic methods.

  Each of them associates a symbol to a method signature. For instance, '+' is associated to 'T add(L x, R y)'.

  The default JexlArithmetic implements generic versions of these methods using Object as arguments. You can use your own derived JexlArithmetic that override and/or overload those operator methods; these methods must be public, must respect the return type when primitive and may be overloaded multiple times with different signatures.

  Since:
    3.0

- - ### Enum Constant Summary

    Enum Constants
    Enum Constant and Description
    `ADD` Syntax: `x + y` Method: `T add(L x, R y);`.
    `AND` Syntax: `x & y` Method: `T and(L x, R y);`.
    `ARRAY_GET` Array get operator as in: x[y].
    `ARRAY_SET` Array set operator as in: x[y] = z.
    `ASSIGN` Marker for side effect.
    `COMPLEMENT` Syntax: `~x` Method: `T complement(L x);`.
    `CONTAINS` Syntax: `x =~ y` Method: `boolean contains(L x, R y);`.
    `DIVIDE` Syntax: `x / y` Method: `T divide(L x, R y);`.
    `EMPTY` Syntax: `empty x` or `empty(x)` Method: `boolean isEmpty(L x);`.
    `ENDSWITH` Syntax: `x =$ y` Method: `boolean endsWith(L x, R y);`.
    `EQ` Syntax: `x == y` Method: `boolean equals(L x, R y);`.
    `GT` Syntax: `x > y` Method: `boolean greaterThan(L x, R y);`.
    `GTE` Syntax: `x >= y` Method: `boolean greaterThanOrEqual(L x, R y);`.
    `LT` Syntax: `x < y` Method: `boolean lessThan(L x, R y);`.
    `LTE` Syntax: `x <= y` Method: `boolean lessThanOrEqual(L x, R y);`.
    `MOD` Syntax: `x % y` Method: `T mod(L x, R y);`.
    `MULTIPLY` Syntax: `x * y` Method: `T multiply(L x, R y);`.
    `NEGATE` Syntax: `-x` Method: `T negate(L x);`.
    `NOT` Syntax: `!`
    `OR` Syntax: `x | y` Method: `T or(L x, R y);`.
    `PROPERTY_GET` Property get operator as in: x.y.
    `PROPERTY_SET` Property set operator as in: x.y = z.
    `SELF_ADD` Syntax: `x += y` Method: `T selfAdd(L x, R y);`.
    `SELF_AND` Syntax: `x &= y` Method: `T selfAnd(L x, R y);`.
    `SELF_DIVIDE` Syntax: `x /= y` Method: `T selfDivide(L x, R y);`.
    `SELF_MOD` Syntax: `x %= y` Method: `T selfMod(L x, R y);`.
    `SELF_MULTIPLY` Syntax: `x *= y` Method: `T selfMultiply(L x, R y);`.
    `SELF_OR` Syntax: `x |= y` Method: `T selfOr(L x, R y);`.
    `SELF_SUBTRACT` Syntax: `x -= y` Method: `T selfSubtract(L x, R y);`.
    `SELF_XOR` Syntax: `x ^= y` Method: `T selfXor(L x, R y);`.
    `SIZE` Syntax: `size x` or `size(x)` Method: `int size(L x);`.
    `STARTSWITH` Syntax: `x =^ y` Method: `boolean startsWith(L x, R y);`.
    `SUBTRACT` Syntax: `x - y` Method: `T subtract(L x, R y);`.
    `XOR` Syntax: `x ^ y` Method: `T xor(L x, R y);`.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `getArity()` Gets this operator number of parameters.
    `JexlOperator` | `getBaseOperator()` Gets the base operator.
    `String` | `getMethodName()` Gets this operator method name in a JexlArithmetic.
    `String` | `getOperatorSymbol()` Gets this operator symbol.
    `static JexlOperator` | `valueOf(String name)` Returns the enum constant of this type with the specified name.
    `static JexlOperator[]` | `values()` Returns an array containing the constants of this enum type, in the order they are declared.

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

      `clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf`

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

      `getClass, notify, notifyAll, wait, wait, wait`

- - ### Enum Constant Detail

    - #### ADD

          public static final JexlOperator ADD

      Syntax: `x + y`
      Method: `T add(L x, R y);`.
      See Also:
        `JexlArithmetic.add(java.lang.Object, java.lang.Object)`

    - #### SUBTRACT

          public static final JexlOperator SUBTRACT

      Syntax: `x - y`
      Method: `T subtract(L x, R y);`.
      See Also:
        `JexlArithmetic.subtract(java.lang.Object, java.lang.Object)`

    - #### MULTIPLY

          public static final JexlOperator MULTIPLY

      Syntax: `x * y`
      Method: `T multiply(L x, R y);`.
      See Also:
        `JexlArithmetic.multiply(java.lang.Object, java.lang.Object)`

    - #### DIVIDE

          public static final JexlOperator DIVIDE

      Syntax: `x / y`
      Method: `T divide(L x, R y);`.
      See Also:
        `JexlArithmetic.divide(java.lang.Object, java.lang.Object)`

    - #### MOD

          public static final JexlOperator MOD

      Syntax: `x % y`
      Method: `T mod(L x, R y);`.
      See Also:
        `JexlArithmetic.mod(java.lang.Object, java.lang.Object)`

    - #### AND

          public static final JexlOperator AND

      Syntax: `x & y`
      Method: `T and(L x, R y);`.
      See Also:
        `JexlArithmetic.and(java.lang.Object, java.lang.Object)`

    - #### OR

          public static final JexlOperator OR

      Syntax: `x | y`
      Method: `T or(L x, R y);`.
      See Also:
        `JexlArithmetic.or(java.lang.Object, java.lang.Object)`

    - #### XOR

          public static final JexlOperator XOR

      Syntax: `x ^ y`
      Method: `T xor(L x, R y);`.
      See Also:
        `JexlArithmetic.xor(java.lang.Object, java.lang.Object)`

    - #### EQ

          public static final JexlOperator EQ

      Syntax: `x == y`
      Method: `boolean equals(L x, R y);`.
      See Also:
        `JexlArithmetic.equals(java.lang.Object, java.lang.Object)`

    - #### LT

          public static final JexlOperator LT

      Syntax: `x < y`
      Method: `boolean lessThan(L x, R y);`.
      See Also:
        `JexlArithmetic.lessThan(java.lang.Object, java.lang.Object)`

    - #### LTE

          public static final JexlOperator LTE

      Syntax: `x <= y`
      Method: `boolean lessThanOrEqual(L x, R y);`.
      See Also:
        `JexlArithmetic.lessThanOrEqual(java.lang.Object, java.lang.Object)`

    - #### GT

          public static final JexlOperator GT

      Syntax: `x > y`
      Method: `boolean greaterThan(L x, R y);`.
      See Also:
        `JexlArithmetic.greaterThan(java.lang.Object, java.lang.Object)`

    - #### GTE

          public static final JexlOperator GTE

      Syntax: `x >= y`
      Method: `boolean greaterThanOrEqual(L x, R y);`.
      See Also:
        `JexlArithmetic.greaterThanOrEqual(java.lang.Object, java.lang.Object)`

    - #### CONTAINS

          public static final JexlOperator CONTAINS

      Syntax: `x =~ y`
      Method: `boolean contains(L x, R y);`.
      See Also:
        `JexlArithmetic.contains(java.lang.Object, java.lang.Object)`

    - #### STARTSWITH

          public static final JexlOperator STARTSWITH

      Syntax: `x =^ y`
      Method: `boolean startsWith(L x, R y);`.
      See Also:
        `JexlArithmetic.startsWith(java.lang.Object, java.lang.Object)`

    - #### ENDSWITH

          public static final JexlOperator ENDSWITH

      Syntax: `x =$ y`
      Method: `boolean endsWith(L x, R y);`.
      See Also:
        `JexlArithmetic.endsWith(java.lang.Object, java.lang.Object)`

    - #### NOT

          public static final JexlOperator NOT

      Syntax: `!x`
      Method: `T not(L x);`.
      See Also:
        `JexlArithmetic.not(java.lang.Object)`

    - #### COMPLEMENT

          public static final JexlOperator COMPLEMENT

      Syntax: `~x`
      Method: `T complement(L x);`.
      See Also:
        `JexlArithmetic.complement(java.lang.Object)`

    - #### NEGATE

          public static final JexlOperator NEGATE

      Syntax: `-x`
      Method: `T negate(L x);`.
      See Also:
        `JexlArithmetic.negate(java.lang.Object)`

    - #### EMPTY

          public static final JexlOperator EMPTY

      Syntax: `empty x` or `empty(x)`
      Method: `boolean isEmpty(L x);`.
      See Also:
        `JexlArithmetic.isEmpty(java.lang.Object)`

    - #### SIZE

          public static final JexlOperator SIZE

      Syntax: `size x` or `size(x)`
      Method: `int size(L x);`.
      See Also:
        `JexlArithmetic.size(java.lang.Object)`

    - #### SELF_ADD

          public static final JexlOperator SELF_ADD

      Syntax: `x += y`
      Method: `T selfAdd(L x, R y);`.

    - #### SELF_SUBTRACT

          public static final JexlOperator SELF_SUBTRACT

      Syntax: `x -= y`
      Method: `T selfSubtract(L x, R y);`.

    - #### SELF_MULTIPLY

          public static final JexlOperator SELF_MULTIPLY

      Syntax: `x *= y`
      Method: `T selfMultiply(L x, R y);`.

    - #### SELF_DIVIDE

          public static final JexlOperator SELF_DIVIDE

      Syntax: `x /= y`
      Method: `T selfDivide(L x, R y);`.

    - #### SELF_MOD

          public static final JexlOperator SELF_MOD

      Syntax: `x %= y`
      Method: `T selfMod(L x, R y);`.

    - #### SELF_AND

          public static final JexlOperator SELF_AND

      Syntax: `x &= y`
      Method: `T selfAnd(L x, R y);`.

    - #### SELF_OR

          public static final JexlOperator SELF_OR

      Syntax: `x |= y`
      Method: `T selfOr(L x, R y);`.

    - #### SELF_XOR

          public static final JexlOperator SELF_XOR

      Syntax: `x ^= y`
      Method: `T selfXor(L x, R y);`.

    - #### ASSIGN

          public static final JexlOperator ASSIGN

      Marker for side effect.
      Returns this from 'self*' overload method to let the engine know the side effect has been performed and there is no need to assign the result.

    - #### PROPERTY_GET

          public static final JexlOperator PROPERTY_GET

      Property get operator as in: x.y.

    - #### PROPERTY_SET

          public static final JexlOperator PROPERTY_SET

      Property set operator as in: x.y = z.

    - #### ARRAY_GET

          public static final JexlOperator ARRAY_GET

      Array get operator as in: x[y].

    - #### ARRAY_SET

          public static final JexlOperator ARRAY_SET

      Array set operator as in: x[y] = z.

  - ### Method Detail

    - #### values

          public static JexlOperator[] values()

      Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:

          for (JexlOperator c : JexlOperator.values())
              System.out.println(c);

      Returns:
        an array containing the constants of this enum type, in the order they are declared

    - #### valueOf

          public static JexlOperator valueOf(String name)

      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
        `name` - the name of the enum constant to be returned.
      Returns:
        the enum constant with the specified name
      Throws:
        `IllegalArgumentException` - if this enum type has no constant with the specified name
        `NullPointerException` - if the argument is null

    - #### getOperatorSymbol

          public final String getOperatorSymbol()

      Gets this operator symbol.
      Returns:
        the symbol

    - #### getMethodName

          public final String getMethodName()

      Gets this operator method name in a JexlArithmetic.
      Returns:
        the method name

    - #### getArity

          public int getArity()

      Gets this operator number of parameters.
      Returns:
        the method arity

    - #### getBaseOperator

          public final JexlOperator getBaseOperator()

      Gets the base operator.
      Returns:
        the base operator

Copyright © 2001–2015 The Apache Software Foundation. All rights reserved.