Casts a list of unchecked JSON values to a list of String. If the given list contains a value that is not a String, throws an exception.
(List<?> rawList)
| 284 | * contains a value that is not a String, throws an exception. |
| 285 | */ |
| 286 | @SuppressWarnings("unchecked") |
| 287 | public static List<String> checkStringList(List<?> rawList) { |
| 288 | for (int i = 0; i < rawList.size(); i++) { |
| 289 | if (!(rawList.get(i) instanceof String)) { |
| 290 | throw new ClassCastException( |
| 291 | String.format( |
| 292 | Locale.US, |
| 293 | "value '%s' for idx %d in '%s' is not string", rawList.get(i), i, rawList)); |
| 294 | } |
| 295 | } |
| 296 | return (List<String>) rawList; |
| 297 | } |
| 298 | |
| 299 | private static final long DURATION_SECONDS_MIN = -315576000000L; |
| 300 | private static final long DURATION_SECONDS_MAX = 315576000000L; |
no test coverage detected