Return a long from the given object Handles the different cases from the various DBMSs @param obj @return
(Object obj)
| 50 | * @return |
| 51 | */ |
| 52 | public static Long getLong(Object obj) { |
| 53 | if (obj == null) { |
| 54 | return (null); |
| 55 | } |
| 56 | |
| 57 | if (obj instanceof Long) { |
| 58 | return (Long) obj; |
| 59 | } else if (obj instanceof Integer) { |
| 60 | return ((Integer) obj).longValue(); |
| 61 | } else if (obj instanceof BigDecimal) { |
| 62 | return ((BigDecimal) obj).longValue(); |
| 63 | } |
| 64 | |
| 65 | LOG.warn("BAD BAD BAD: returning null because getLong does not support {}", obj.getClass()); |
| 66 | |
| 67 | return (null); |
| 68 | } |
| 69 | |
| 70 | public static Integer getInteger(Object obj) { |
| 71 | if (obj == null) { |
no test coverage detected