File tree Expand file tree Collapse file tree 2 files changed +9
-7
lines changed
spring-expression/src/main/java/org/springframework/expression/spel/ast Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2002-2009 the original author or authors.
2
+ * Copyright 2002-2012 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
25
25
* Implements division operator.
26
26
*
27
27
* @author Andy Clement
28
+ * @author Juergen Hoeller
28
29
* @since 3.0
29
30
*/
30
31
public class OpDivide extends Operator {
@@ -42,14 +43,16 @@ public TypedValue getValueInternal(ExpressionState state) throws EvaluationExcep
42
43
Number op2 = (Number ) operandTwo ;
43
44
if (op1 instanceof Double || op2 instanceof Double ) {
44
45
return new TypedValue (op1 .doubleValue () / op2 .doubleValue ());
45
- } else if (op1 instanceof Long || op2 instanceof Long ) {
46
+ }
47
+ else if (op1 instanceof Long || op2 instanceof Long ) {
46
48
return new TypedValue (op1 .longValue () / op2 .longValue ());
47
- } else { // TODO what about non-int result of the division?
49
+ }
50
+ else {
51
+ // TODO what about non-int result of the division?
48
52
return new TypedValue (op1 .intValue () / op2 .intValue ());
49
53
}
50
54
}
51
- Object result = state .operate (Operation .DIVIDE , operandOne , operandTwo );
52
- return new TypedValue (result );
55
+ return state .operate (Operation .DIVIDE , operandOne , operandTwo );
53
56
}
54
57
55
58
}
Original file line number Diff line number Diff line change @@ -48,13 +48,12 @@ public OpMultiply(int pos, SpelNodeImpl... operands) {
48
48
* Implements the {@code multiply} operator directly here for certain types
49
49
* of supported operands and otherwise delegates to any registered overloader
50
50
* for types not supported here.
51
- *
52
51
* <p>Supported operand types:
53
52
* <ul>
54
53
* <li>doubles
55
54
* <li>longs
56
55
* <li>integers
57
- * <li>string and int ('abc' * 2 == 'abcabc')
56
+ * <li>String and int ('abc' * 2 == 'abcabc')
58
57
* </ul>
59
58
*/
60
59
@ Override
You can’t perform that action at this time.
0 commit comments