| 365 | * This method duplicates code in org.apache.el.util.ReflectionUtil. When making changes keep the code in sync. |
| 366 | */ |
| 367 | static boolean isAssignableFrom(Class<?> src, Class<?> target) { |
| 368 | // src will always be an object |
| 369 | // Short-cut. null is always assignable to an object and in EL null |
| 370 | // can always be coerced to a valid value for a primitive |
| 371 | if (src == null) { |
| 372 | return true; |
| 373 | } |
| 374 | |
| 375 | Class<?> targetClass; |
| 376 | if (target.isPrimitive()) { |
| 377 | if (target == Boolean.TYPE) { |
| 378 | targetClass = Boolean.class; |
| 379 | } else if (target == Character.TYPE) { |
| 380 | targetClass = Character.class; |
| 381 | } else if (target == Byte.TYPE) { |
| 382 | targetClass = Byte.class; |
| 383 | } else if (target == Short.TYPE) { |
| 384 | targetClass = Short.class; |
| 385 | } else if (target == Integer.TYPE) { |
| 386 | targetClass = Integer.class; |
| 387 | } else if (target == Long.TYPE) { |
| 388 | targetClass = Long.class; |
| 389 | } else if (target == Float.TYPE) { |
| 390 | targetClass = Float.class; |
| 391 | } else { |
| 392 | targetClass = Double.class; |
| 393 | } |
| 394 | } else { |
| 395 | targetClass = target; |
| 396 | } |
| 397 | return targetClass.isAssignableFrom(src); |
| 398 | } |
| 399 | |
| 400 | |
| 401 | /* |