Casts a list of unchecked JSON values to a list of checked objects in Java type. If the given list contains a value that is not a Map, throws an exception.
(List<?> rawList)
| 268 | * If the given list contains a value that is not a Map, throws an exception. |
| 269 | */ |
| 270 | @SuppressWarnings("unchecked") |
| 271 | public static List<Map<String, ?>> checkObjectList(List<?> rawList) { |
| 272 | for (int i = 0; i < rawList.size(); i++) { |
| 273 | if (!(rawList.get(i) instanceof Map)) { |
| 274 | throw new ClassCastException( |
| 275 | String.format( |
| 276 | Locale.US, "value %s for idx %d in %s is not object", rawList.get(i), i, rawList)); |
| 277 | } |
| 278 | } |
| 279 | return (List<Map<String, ?>>) rawList; |
| 280 | } |
| 281 | |
| 282 | /** |
| 283 | * Casts a list of unchecked JSON values to a list of String. If the given list |
no test coverage detected