(JsonObject obj, String key)
| 62 | } |
| 63 | |
| 64 | public static List<String> safeListString(JsonObject obj, String key) { |
| 65 | List<String> result = new ArrayList<>(); |
| 66 | if (!obj.has(key)) return result; |
| 67 | if (obj.get(key).isJsonObject()) result.add(safeString(obj, key)); |
| 68 | else for (JsonElement opt : obj.getAsJsonArray(key)) result.add(opt.getAsString()); |
| 69 | return result; |
| 70 | } |
| 71 | |
| 72 | public static List<JsonElement> safeListElement(JsonObject obj, String key) { |
| 73 | List<JsonElement> result = new ArrayList<>(); |
no test coverage detected