Top Description Methods
org.springframework.expression

public Interface OperatorOverloader

Known Direct Implementers
org.springframework.expression.spel.support.StandardOperatorOverloader
Imports
org.springframework.lang.Nullable

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.
Author
Andy Clement
Since
3.0

Method Summary

Modifier and TypeMethod and Description
public Object

Returns:

the result of performing the operation on the two operands
operate
(Operation
the operation to be performed
operation
,
Object
the left operand
leftOperand
,
Object
the right operand
rightOperand
)

Perform the specified operation on the two operands, returning a result.

public boolean

Returns:

true if this OperatorOverloader supports the specified operation between the two operands
overridesOperation
(Operation
the operation to be performed
operation
,
Object
the left operand
leftOperand
,
Object
the right operand
rightOperand
)

Return true if this operator overloader supports the specified operation on the two operands and should be invoked to handle it.

Method Detail

operateback to summary
public Object operate(Operation operation, Object leftOperand, Object rightOperand) throws EvaluationException

Perform the specified operation on the two operands, returning a result.

See Operation for supported operations.

Parameters
operation:Operation

the operation to be performed

leftOperand:Object

the left operand

rightOperand:Object

the right operand

Returns:Object

the result of performing the operation on the two operands

Exceptions
EvaluationException:
if there is a problem performing the operation
overridesOperationback to summary
public boolean overridesOperation(Operation operation, Object leftOperand, Object rightOperand) throws EvaluationException

Return true if this operator overloader supports the specified operation on the two operands and should be invoked to handle it.

Parameters
operation:Operation

the operation to be performed

leftOperand:Object

the left operand

rightOperand:Object

the right operand

Returns:boolean

true if this OperatorOverloader supports the specified operation between the two operands

Exceptions
EvaluationException:
if there is a problem performing the operation