| 869 | } |
| 870 | |
| 871 | private static Long toLong(Object o) { |
| 872 | if (o instanceof Long) return (Long) o; |
| 873 | if (o instanceof Integer) return ((Integer) o).longValue(); |
| 874 | if (o instanceof Double) return ((Double) o).longValue(); |
| 875 | if (o instanceof Float) return ((Float) o).longValue(); |
| 876 | if (o instanceof BigDecimal) return ((BigDecimal) o).longValue(); |
| 877 | if (o instanceof String) return Long.parseLong((String) o); |
| 878 | return Long.parseLong(String.valueOf(o)); |
| 879 | } |
| 880 | |
| 881 | private static int toInt(Object o) { |
| 882 | if (o instanceof Integer) return (Integer) o; |