MCPcopy Index your code
hub / github.com/google/gson / getAsJsonArray

Method getAsJsonArray

src/main/java/com/google/gson/JsonElement.java:95–100  ·  view source on GitHub ↗

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

()

Source from the content-addressed store, hash-verified

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

Callers 3

testParseMixedArrayMethod · 0.95
visitArrayMethod · 0.95

Calls 1

isJsonArrayMethod · 0.95

Tested by 2

testParseMixedArrayMethod · 0.76