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

Method getAsInt

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

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

()

Source from the content-addressed store, hash-verified

342 * @throws IllegalStateException if the array is empty or has more than one element.
343 */
344 @Override
345 public int getAsInt() {
346 return getAsSingleElement().getAsInt();
347 }
348
349 /**
350 * Convenience method to get this array as a primitive byte if it contains a single element. This

Callers 15

testReplaceAllMethod · 0.45
readMethod · 0.45
deserializeMethod · 0.45
testParseStringMethod · 0.45
testParseMixedArrayMethod · 0.45
testParseReaderMethod · 0.45

Calls 1

getAsSingleElementMethod · 0.95

Tested by 13

testReplaceAllMethod · 0.36
readMethod · 0.36
deserializeMethod · 0.36
testParseStringMethod · 0.36
testParseMixedArrayMethod · 0.36
testParseReaderMethod · 0.36