Interface JexlOperator.Uberspect
- All Superinterfaces:
- JexlArithmetic.Uberspect
- Enclosing class:
- JexlOperator
This is used by the interpreter to find and execute operator overloads implemented in a derived JexlArithmetic - or in some cases, as methods of the left argument type (contains, size, ...).
This also allows reusing the core logic when extending the applicative type-system; for
 instance, implementing a Comparator class that calls compare
 (operator.tryOverload(this, JexlOperator.COMPARE, left, right), etc.
- Since:
- 3.5.0
- 
Method SummaryModifier and TypeMethodDescriptionbooleancontains(JexlCache.Reference node, JexlOperator operator, Object left, Object right) The 'match'/'in' operator implementation.empty(JexlCache.Reference node, Object object) Check for emptiness of various types: Collection, Array, Map, String, and anything that has a boolean isEmpty() method.booleanendsWith(JexlCache.Reference node, JexlOperator operator, Object left, Object right) The 'endsWith' operator implementation.size(JexlCache.Reference node, Object object) Calculate thesizeof various types: Collection, Array, Map, String, and anything that has an int size() method.booleanstartsWith(JexlCache.Reference node, JexlOperator operator, Object left, Object right) The 'startsWith' operator implementation.tryAssignOverload(JexlCache.Reference node, JexlOperator operator, Consumer<Object> assign, Object... args) Evaluates an assign operator.tryOverload(JexlCache.Reference reference, JexlOperator operator, Object... args) Try to find the most specific method and evaluate an operator.Methods inherited from interface org.apache.commons.jexl3.JexlArithmetic.UberspectgetOperator, overloads
- 
Method Details- 
tryOverloadTry to find the most specific method and evaluate an operator.This method does not call JexlArithmetic.Uberspect.overloads(JexlOperator)and shall not be called with an assignment operator; usetryAssignOverload(JexlCache.Reference, JexlOperator, Consumer, Object...)in that case.- Parameters:
- reference- an optional reference caching resolved method or failing signature
- operator- the operator
- args- the arguments
- Returns:
- TRY_FAILED if no specific method could be found, the evaluation result otherwise
 
- 
tryAssignOverloadObject tryAssignOverload(JexlCache.Reference node, JexlOperator operator, Consumer<Object> assign, Object... args) Evaluates an assign operator.This takes care of finding and caching the operator method when appropriate. If an overloads returns a value not-equal to TRY_FAILED, it means the side-effect is complete. Otherwise, a += b <=> a = a + b- Parameters:
- node- an optional reference caching resolved method or failing signature
- operator- the operator
- assign- the actual function that performs the side effect
- args- the arguments, the first one being the target of assignment
- Returns:
- JexlEngine.TRY_FAILED if no operation was performed, the value to use as the side effect argument otherwise
 
- 
sizeCalculate thesizeof various types: Collection, Array, Map, String, and anything that has an int size() method.Seeks an overload or use the default arithmetic implementation. Note that the result may not be an integer. - Parameters:
- node- an optional reference caching resolved method or failing signature
- object- the object to get the size of
- Returns:
- the evaluation result
 
- 
emptyCheck for emptiness of various types: Collection, Array, Map, String, and anything that has a boolean isEmpty() method.Seeks an overload or use the default arithmetic implementation. Note that the result may not be a boolean. - Parameters:
- node- the node holding the object
- object- the object to check the emptiness of
- Returns:
- the evaluation result
 
- 
containsThe 'match'/'in' operator implementation.Seeks an overload or use the default arithmetic 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- an optional reference caching resolved method or failing signature
- operator- the calling operator, =~ or !~
- left- the right operand
- right- the left operand
- Returns:
- true if left matches right, false otherwise
 
- 
startsWithThe 'startsWith' operator implementation.Seeks an overload or use the default arithmetic implementation. - Parameters:
- node- an optional reference caching resolved method or failing signature
- operator- the calling operator, $= or $!
- left- the left operand
- right- the right operand
- Returns:
- true if left starts with right, false otherwise
 
- 
endsWithThe 'endsWith' operator implementation.Seeks an overload or use the default arithmetic implementation. - Parameters:
- node- an optional reference caching resolved method or failing signature
- operator- the calling operator, ^= or ^!
- left- the left operand
- right- the right operand
- Returns:
- true if left ends with right, false otherwise
 
 
-