public class Operators extends Object
Modifier and Type | Field and Description |
---|---|
protected Interpreter |
interpreter
The owner.
|
protected JexlArithmetic.Uberspect |
operators
The overloaded arithmetic operators.
|
Modifier | Constructor and Description |
---|---|
protected |
Operators(Interpreter owner)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
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.
|
protected final Interpreter interpreter
protected final JexlArithmetic.Uberspect operators
protected Operators(Interpreter owner)
owner
- the owning interpreterprotected Object tryOverload(JexlNode node, JexlOperator operator, Object... args)
This takes care of finding and caching the operator method when appropriate
node
- the syntactic nodeoperator
- the operatorargs
- the argumentsprotected Object tryAssignOverload(JexlNode node, JexlOperator operator, Object... args)
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
node
- the syntactic nodeoperator
- the operatorargs
- the arguments, the first one being the target of assignmentprotected boolean startsWith(JexlNode node, String operator, Object left, Object right)
node
- the nodeoperator
- the calling operator, $= or $!left
- the left operandright
- the right operandprotected boolean endsWith(JexlNode node, String operator, Object left, Object right)
node
- the nodeoperator
- the calling operator, ^= or ^!left
- the left operandright
- the right operandprotected boolean contains(JexlNode node, String op, Object left, Object right)
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.
node
- the nodeop
- the calling operator, =~ or !~right
- the left operandleft
- the right operandprotected Object empty(JexlNode node, Object object)
Note that the result may not be a boolean.
node
- the node holding the objectobject
- the object to check the emptyness ofprotected Object size(JexlNode node, Object object)
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.
node
- the node that gave the value to sizeobject
- the object to get the size of.Copyright © 2001–2015 The Apache Software Foundation. All rights reserved.