(TableX<?, ?> table, String key)
| 98 | } |
| 99 | |
| 100 | private static Object parseKey(TableX<?, ?> table, String key) { |
| 101 | Object k; |
| 102 | Type keyType; |
| 103 | if (table instanceof TableDynamic) |
| 104 | keyType = table.getKeyClass(); |
| 105 | else |
| 106 | keyType = ((ParameterizedType)table.getClass().getGenericSuperclass()).getActualTypeArguments()[0]; |
| 107 | if (keyType == Long.class) |
| 108 | k = Long.parseLong(key); |
| 109 | else if (keyType == Integer.class) |
| 110 | k = Integer.parseInt(key); |
| 111 | else if (keyType == String.class) |
| 112 | k = key; |
| 113 | else if (keyType == Binary.class) |
| 114 | k = new Binary(key); |
| 115 | else if (keyType instanceof Class && Serializable.class.isAssignableFrom((Class<?>)keyType)) // BeanKey |
| 116 | k = Json.parse(key, (Class<?>)keyType); |
| 117 | else |
| 118 | throw new IllegalStateException("ERROR: unsupported key of " + keyType + " for table " + table.getName()); |
| 119 | return k; |
| 120 | } |
| 121 | |
| 122 | @SuppressWarnings("unchecked") |
| 123 | public static <K extends Comparable<K>, V extends Bean> K walkKey(TableX<?, ?> table, Object exclusiveStartKey, |
no test coverage detected