Add two objects, coercing them to the appropriate numeric type. @param obj0 The first operand @param obj1 The second operand @return The result of the addition
(final Object obj0, final Object obj1)
| 306 | * @return The result of the addition |
| 307 | */ |
| 308 | public static Number add(final Object obj0, final Object obj1) { |
| 309 | final ELArithmetic delegate = findDelegate(obj0, obj1); |
| 310 | if (delegate == null) { |
| 311 | return Long.valueOf(0); |
| 312 | } |
| 313 | |
| 314 | Number num0 = delegate.coerce(obj0); |
| 315 | Number num1 = delegate.coerce(obj1); |
| 316 | |
| 317 | return delegate.add(num0, num1); |
| 318 | } |
| 319 | |
| 320 | /** |
| 321 | * Compute the modulo of two objects, coercing them to the appropriate numeric type. |