Interface OperatorOverloader
- All Known Implementing Classes:
StandardOperatorOverloader
public interface OperatorOverloader
By default, the mathematical operators defined in
Operation support simple
types like numbers. By providing an implementation of OperatorOverloader,
a user of the expression language can support these operations on other types.- Since:
- 3.0
- Author:
- Andy Clement
-
Method Summary
Modifier and TypeMethodDescriptionPerform the specified operation on the two operands, returning a result.booleanoverridesOperation(Operation operation, @Nullable Object leftOperand, @Nullable Object rightOperand) Returntrueif this operator overloader supports the specified operation on the two operands and should be invoked to handle it.
-
Method Details
-
overridesOperation
boolean overridesOperation(Operation operation, @Nullable Object leftOperand, @Nullable Object rightOperand) throws EvaluationException Returntrueif this operator overloader supports the specified operation on the two operands and should be invoked to handle it.- Parameters:
operation- the operation to be performedleftOperand- the left operandrightOperand- the right operand- Returns:
- true if this
OperatorOverloadersupports the specified operation between the two operands - Throws:
EvaluationException- if there is a problem performing the operation
-
operate
Object operate(Operation operation, @Nullable Object leftOperand, @Nullable Object rightOperand) throws EvaluationException Perform the specified operation on the two operands, returning a result.See
Operationfor supported operations.- Parameters:
operation- the operation to be performedleftOperand- the left operandrightOperand- the right operand- Returns:
- the result of performing the operation on the two operands
- Throws:
EvaluationException- if there is a problem performing the operation
-