Get a Map value from a Map @param map Source map @param key The key @return The Map value @throws IllegalArgumentException If value is not a Map and cannot be converted
(Map<String, Object> map, String key)
| 327 | * @throws IllegalArgumentException If value is not a Map and cannot be converted |
| 328 | */ |
| 329 | @SuppressWarnings("unchecked") |
| 330 | public static <K, V> Map<K, V> getMap(Map<String, Object> map, String key) throws IllegalArgumentException { |
| 331 | Object value = map == null || key == null ? null : map.get(key); |
| 332 | if (value == null) { |
| 333 | return null; |
| 334 | } |
| 335 | |
| 336 | if (value instanceof Map) { |
| 337 | return (Map<K, V>) value; |
| 338 | } |
| 339 | |
| 340 | throw new IllegalArgumentException("Value for key '" + key + "' is not a Map: " + value.getClass().getName()); |
| 341 | } |
| 342 | |
| 343 | /** |
| 344 | * Get a List value from a Map |
no test coverage detected