MCPcopy
hub / github.com/google/gson / getAsNumber

Method getAsNumber

gson/src/main/java/com/google/gson/JsonArray.java:251–254  ·  view source on GitHub ↗

Convenience method to get this array as a {@link Number} if it contains a single element. This method calls {@link JsonElement#getAsNumber()} on the element, therefore any of the exceptions declared by that method can occur. @return this element as a number if it is single element array. @throws Il

()

Source from the content-addressed store, hash-verified

249 * @throws IllegalStateException if the array is empty or has more than one element.
250 */
251 @Override
252 public Number getAsNumber() {
253 return getAsSingleElement().getAsNumber();
254 }
255
256 /**
257 * Convenience method to get this array as a {@link String} if it contains a single element. This

Callers

nothing calls this directly

Calls 1

getAsSingleElementMethod · 0.95

Tested by

no test coverage detected