Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.commons.jexl3.internal
Class Operators

    java.lang.Object
      org.apache.commons.jexl3.internal.Operators

    public class Operators

extends Object

Helper class to deal with operator overloading and specifics.

Since:
  3.0

Field Summary
`protected Interpreter` | `interpreter` The owner.
`protected JexlArithmetic.Uberspect` | `operators` The overloaded arithmetic operators.

Constructor Summary
`protected` | `Operators(Interpreter owner)` Constructor.

Method Summary
`protected boolean` | `contains(JexlNode node, String op, Object left, Object right)` The 'match'/'in' operator implementation.
`protected Object` | `empty(JexlNode node, Object object)` Check for emptyness of various types: Collection, Array, Map, String, and anything that has a boolean isEmpty() method.
`protected boolean` | `endsWith(JexlNode node, String operator, Object left, Object right)` The 'endsWith' operator implementation.
`protected Object` | `size(JexlNode node, Object object)` Calculate the `size` of various types: Collection, Array, Map, String, and anything that has a int size() method.
`protected boolean` | `startsWith(JexlNode node, String operator, Object left, Object right)` The 'startsWith' operator implementation.
`protected Object` | `tryAssignOverload(JexlNode node, JexlOperator operator, Object... args)` Evaluates an assign operator.
`protected Object` | `tryOverload(JexlNode node, JexlOperator operator, Object... args)` Attempts to call an operator.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### interpreter

    protected final Interpreter interpreter

  The owner.

### operators

    protected final JexlArithmetic.Uberspect operators

  The overloaded arithmetic operators.

Constructor Detail

### Operators

    protected Operators(Interpreter owner)

  Constructor.

  Parameters:
    `owner` - the owning interpreter

Method Detail

### tryOverload

    protected Object tryOverload(JexlNode node,
                                 JexlOperator operator,
                                 Object... args)

  Attempts to call an operator.

  This takes care of finding and caching the operator method when appropriate

  Parameters:
    `node` - the syntactic node
    `operator` - the operator
    `args` - the arguments
  Returns:
    the result of the operator evaluation or TRY_FAILED

### tryAssignOverload

    protected Object tryAssignOverload(JexlNode node,
                                       JexlOperator operator,
                                       Object... args)

  Evaluates an assign operator.

  This takes care of finding and caching the operator method when appropriate. If an overloads returns Operator.ASSIGN, it means the side-effect is complete. Otherwise, a += b <=> a = a + b

  Parameters:
    `node` - the syntactic node
    `operator` - the operator
    `args` - the arguments, the first one being the target of assignment
  Returns:
    the result of the operator evaluation

### startsWith

    protected boolean startsWith(JexlNode node,
                                 String operator,
                                 Object left,
                                 Object right)

  The 'startsWith' operator implementation.

  Parameters:
    `node` - the node
    `operator` - the calling operator, $= or $!
    `left` - the left operand
    `right` - the right operand
  Returns:
    true if left starts with right, false otherwise

### endsWith

    protected boolean endsWith(JexlNode node,
                               String operator,
                               Object left,
                               Object right)

  The 'endsWith' operator implementation.

  Parameters:
    `node` - the node
    `operator` - the calling operator, ^= or ^!
    `left` - the left operand
    `right` - the right operand
  Returns:
    true if left ends with right, false otherwise

### contains

    protected boolean contains(JexlNode node,
                               String op,
                               Object left,
                               Object right)

  The 'match'/'in' operator implementation.

  Note that 'x in y' or 'x matches y' means 'y contains x' ; the JEXL operator arguments order syntax is the reverse of this method call.

  Parameters:
    `node` - the node
    `op` - the calling operator, =~ or !~
    `right` - the left operand
    `left` - the right operand
  Returns:
    true if left matches right, false otherwise

### empty

    protected Object empty(JexlNode node,
                           Object object)

  Check for emptyness of various types: Collection, Array, Map, String, and anything that has a boolean isEmpty() method.

  Note that the result may not be a boolean.

  Parameters:
    `node` - the node holding the object
    `object` - the object to check the emptyness of
  Returns:
    the evaluation result

### size

    protected Object size(JexlNode node,
                          Object object)

  Calculate the `size` of various types: Collection, Array, Map, String, and anything that has a int size() method.

  Note that the result may not be an integer.

  Parameters:
    `node` - the node that gave the value to size
    `object` - the object to get the size of.
  Returns:
    the evaluation result

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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