org.springframework.expression.OperatorOverloader Java Examples
The following examples show how to use
org.springframework.expression.OperatorOverloader.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ExpressionState.java From spring4-understanding with Apache License 2.0 | 5 votes |
public TypedValue operate(Operation op, Object left, Object right) throws EvaluationException { OperatorOverloader overloader = this.relatedContext.getOperatorOverloader(); if (overloader.overridesOperation(op, left, right)) { Object returnValue = overloader.operate(op, left, right); return new TypedValue(returnValue); } else { String leftType = (left == null ? "null" : left.getClass().getName()); String rightType = (right == null? "null" : right.getClass().getName()); throw new SpelEvaluationException(SpelMessage.OPERATOR_NOT_SUPPORTED_BETWEEN_TYPES, op, leftType, rightType); } }
Example #2
Source File: ExpressionState.java From spring-analysis-note with MIT License | 5 votes |
public TypedValue operate(Operation op, @Nullable Object left, @Nullable Object right) throws EvaluationException { OperatorOverloader overloader = this.relatedContext.getOperatorOverloader(); if (overloader.overridesOperation(op, left, right)) { Object returnValue = overloader.operate(op, left, right); return new TypedValue(returnValue); } else { String leftType = (left == null ? "null" : left.getClass().getName()); String rightType = (right == null? "null" : right.getClass().getName()); throw new SpelEvaluationException(SpelMessage.OPERATOR_NOT_SUPPORTED_BETWEEN_TYPES, op, leftType, rightType); } }
Example #3
Source File: ExpressionState.java From lams with GNU General Public License v2.0 | 5 votes |
public TypedValue operate(Operation op, Object left, Object right) throws EvaluationException { OperatorOverloader overloader = this.relatedContext.getOperatorOverloader(); if (overloader.overridesOperation(op, left, right)) { Object returnValue = overloader.operate(op, left, right); return new TypedValue(returnValue); } else { String leftType = (left == null ? "null" : left.getClass().getName()); String rightType = (right == null? "null" : right.getClass().getName()); throw new SpelEvaluationException(SpelMessage.OPERATOR_NOT_SUPPORTED_BETWEEN_TYPES, op, leftType, rightType); } }
Example #4
Source File: ExpressionState.java From java-technology-stack with MIT License | 5 votes |
public TypedValue operate(Operation op, @Nullable Object left, @Nullable Object right) throws EvaluationException { OperatorOverloader overloader = this.relatedContext.getOperatorOverloader(); if (overloader.overridesOperation(op, left, right)) { Object returnValue = overloader.operate(op, left, right); return new TypedValue(returnValue); } else { String leftType = (left == null ? "null" : left.getClass().getName()); String rightType = (right == null? "null" : right.getClass().getName()); throw new SpelEvaluationException(SpelMessage.OPERATOR_NOT_SUPPORTED_BETWEEN_TYPES, op, leftType, rightType); } }
Example #5
Source File: StandardComponentsTests.java From spring4-understanding with Apache License 2.0 | 4 votes |
@Test(expected = EvaluationException.class) public void testStandardOperatorOverloader() throws EvaluationException { OperatorOverloader oo = new StandardOperatorOverloader(); assertFalse(oo.overridesOperation(Operation.ADD, null, null)); oo.operate(Operation.ADD, 2, 3); }
Example #6
Source File: SimpleEvaluationContext.java From spring-analysis-note with MIT License | 4 votes |
/** * Return an instance of {@link StandardOperatorOverloader}. */ @Override public OperatorOverloader getOperatorOverloader() { return this.operatorOverloader; }
Example #7
Source File: StandardEvaluationContext.java From spring4-understanding with Apache License 2.0 | 4 votes |
@Override public OperatorOverloader getOperatorOverloader() { return this.operatorOverloader; }
Example #8
Source File: StandardEvaluationContext.java From spring4-understanding with Apache License 2.0 | 4 votes |
public void setOperatorOverloader(OperatorOverloader operatorOverloader) { Assert.notNull(operatorOverloader, "OperatorOverloader must not be null"); this.operatorOverloader = operatorOverloader; }
Example #9
Source File: StandardEvaluationContext.java From lams with GNU General Public License v2.0 | 4 votes |
@Override public OperatorOverloader getOperatorOverloader() { return this.operatorOverloader; }
Example #10
Source File: StandardEvaluationContext.java From lams with GNU General Public License v2.0 | 4 votes |
public void setOperatorOverloader(OperatorOverloader operatorOverloader) { Assert.notNull(operatorOverloader, "OperatorOverloader must not be null"); this.operatorOverloader = operatorOverloader; }
Example #11
Source File: StandardComponentsTests.java From java-technology-stack with MIT License | 4 votes |
@Test(expected = EvaluationException.class) public void testStandardOperatorOverloader() throws EvaluationException { OperatorOverloader oo = new StandardOperatorOverloader(); assertFalse(oo.overridesOperation(Operation.ADD, null, null)); oo.operate(Operation.ADD, 2, 3); }
Example #12
Source File: StandardEvaluationContext.java From java-technology-stack with MIT License | 4 votes |
@Override public OperatorOverloader getOperatorOverloader() { return this.operatorOverloader; }
Example #13
Source File: StandardEvaluationContext.java From java-technology-stack with MIT License | 4 votes |
public void setOperatorOverloader(OperatorOverloader operatorOverloader) { Assert.notNull(operatorOverloader, "OperatorOverloader must not be null"); this.operatorOverloader = operatorOverloader; }
Example #14
Source File: SimpleEvaluationContext.java From java-technology-stack with MIT License | 4 votes |
/** * Return an instance of {@link StandardOperatorOverloader}. */ @Override public OperatorOverloader getOperatorOverloader() { return this.operatorOverloader; }
Example #15
Source File: StandardComponentsTests.java From spring-analysis-note with MIT License | 4 votes |
@Test(expected = EvaluationException.class) public void testStandardOperatorOverloader() throws EvaluationException { OperatorOverloader oo = new StandardOperatorOverloader(); assertFalse(oo.overridesOperation(Operation.ADD, null, null)); oo.operate(Operation.ADD, 2, 3); }
Example #16
Source File: StandardEvaluationContext.java From spring-analysis-note with MIT License | 4 votes |
@Override public OperatorOverloader getOperatorOverloader() { return this.operatorOverloader; }
Example #17
Source File: StandardEvaluationContext.java From spring-analysis-note with MIT License | 4 votes |
public void setOperatorOverloader(OperatorOverloader operatorOverloader) { Assert.notNull(operatorOverloader, "OperatorOverloader must not be null"); this.operatorOverloader = operatorOverloader; }