support for concatenation with String via operator '+' - for Ramnivas.

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@1452 50f2f4bb-b051-0410-bef5-90022cba6387
This commit is contained in:
Andy Clement
2009-06-30 19:19:07 +00:00
parent 63fde6ecdb
commit a2e961de94
3 changed files with 16 additions and 4 deletions
@@ -73,6 +73,14 @@ public class OpPlus extends Operator {
}
} else if (operandOne instanceof String && operandTwo instanceof String) {
return new TypedValue(new StringBuilder((String) operandOne).append((String) operandTwo).toString(),STRING_TYPE_DESCRIPTOR);
} else if (operandOne instanceof String) {
StringBuilder result = new StringBuilder((String)operandOne);
result.append((operandTwo==null?"null":operandTwo.toString()));
return new TypedValue(result.toString(),STRING_TYPE_DESCRIPTOR);
} else if (operandTwo instanceof String) {
StringBuilder result = new StringBuilder((operandOne==null?"null":operandOne.toString()));
result.append((String)operandTwo);
return new TypedValue(result.toString(),STRING_TYPE_DESCRIPTOR);
}
return state.operate(Operation.ADD, operandOne, operandTwo);
}