MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / readArray

Method readArray

java/src/org/openqa/selenium/json/JsonInput.java:707–723  ·  view source on GitHub ↗

Read an array of elements from the JSON input stream with elements as the specified type. @param type data type for deserialization (class or TypeToken) @return list of objects of the specified type deserialized from the JSON input stream NOTE : Returns null if the inp

(Type type)

Source from the content-addressed store, hash-verified

705 * @throws UncheckedIOException if an I/O exception is encountered
706 */
707 @SuppressWarnings("unchecked")
708 public <T> List<T> readArray(Type type) {
709 List<T> toReturn = new ArrayList<>();
710 BiFunction<JsonInput, PropertySetting, Object> elementCoercer = null;
711
712 beginArray();
713 while (hasNext()) {
714 // Resolved on the first element, so an empty array never needs a coercer for its type.
715 if (elementCoercer == null) {
716 elementCoercer = coercer.resolve(type);
717 }
718 toReturn.add((T) elementCoercer.apply(this, setter));
719 }
720 endArray();
721
722 return toReturn;
723 }
724
725 /**
726 * Determine if awaiting a JSON object property name.

Callers 2

canReadListOfTypeMethod · 0.80

Calls 6

beginArrayMethod · 0.95
hasNextMethod · 0.95
endArrayMethod · 0.95
addMethod · 0.65
resolveMethod · 0.45
applyMethod · 0.45

Tested by 2

canReadListOfTypeMethod · 0.64