convenience method to get this element as a JsonArray. If the element is of some other type, a ClassCastException will result. Hence it is best to use this method after ensuring that this element is of the desired type by calling #isJsonArray() first. @return get this elemen
()
| 93 | * @throws IllegalStateException if the element is of another type. |
| 94 | */ |
| 95 | public JsonArray getAsJsonArray() { |
| 96 | if (isJsonArray()) { |
| 97 | return (JsonArray) this; |
| 98 | } |
| 99 | throw new IllegalStateException("This is not a JSON Array."); |
| 100 | } |
| 101 | |
| 102 | /** |
| 103 | * convenience method to get this element as a {@link JsonPrimitive}. If the element is of some |