接口 OperatorOverloader
- 所有已知实现类:
StandardOperatorOverloader
public interface OperatorOverloader
By default the mathematical operators
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.- 从以下版本开始:
- 4.0
- 作者:
- Andy Clement, Harry Yang
-
字段概要
字段 -
方法概要
修饰符和类型方法说明Execute the specified operation on two operands, returning a result.booleanoverridesOperation(Operation operation, Object leftOperand, Object rightOperand) Return true if the operator overloader supports the specified operation between the two operands and so should be invoked to handle it.
-
字段详细资料
-
STANDARD
-
-
方法详细资料
-
overridesOperation
boolean overridesOperation(Operation operation, @Nullable Object leftOperand, @Nullable Object rightOperand) throws EvaluationException Return true if the operator overloader supports the specified operation between the two operands and so should be invoked to handle it.- 参数:
operation- the operation to be performedleftOperand- the left operandrightOperand- the right operand- 返回:
- true if the OperatorOverloader supports the specified operation between the two operands
- 抛出:
EvaluationException- if there is a problem performing the operation
-
operate
Object operate(Operation operation, @Nullable Object leftOperand, @Nullable Object rightOperand) throws EvaluationException Execute the specified operation on two operands, returning a result. SeeOperationfor supported operations.- 参数:
operation- the operation to be performedleftOperand- the left operandrightOperand- the right operand- 返回:
- the result of performing the operation on the two operands
- 抛出:
EvaluationException- if there is a problem performing the operation
-