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

Method getAsString

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

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

()

Source from the content-addressed store, hash-verified

262 * @throws IllegalStateException if the array is empty or has more than one element.
263 */
264 @Override
265 public String getAsString() {
266 return getAsSingleElement().getAsString();
267 }
268
269 /**
270 * Convenience method to get this array as a double if it contains a single element. This method

Callers 15

testParseTwoStringsMethod · 0.45
testIteratorMethod · 0.45
testRemoveMethod · 0.45
testSetMethod · 0.45
testParseStringMethod · 0.45
testParseMixedArrayMethod · 0.45

Calls 1

getAsSingleElementMethod · 0.95

Tested by 15

testParseTwoStringsMethod · 0.36
testIteratorMethod · 0.36
testRemoveMethod · 0.36
testSetMethod · 0.36
testParseStringMethod · 0.36
testParseMixedArrayMethod · 0.36
testParseReaderMethod · 0.36