MCPcopy Index your code
hub / github.com/SeleniumHQ/selenium / get

Method get

java/src/org/openqa/selenium/grid/web/Values.java:53–83  ·  view source on GitHub ↗
(HttpResponse response, Type typeOfT)

Source from the content-addressed store, hash-verified

51 }
52
53 @Nullable
54 public static <T> T get(HttpResponse response, Type typeOfT) {
55 try (Reader reader = reader(response);
56 JsonInput input = JSON.newInput(reader)) {
57
58 // Alright then. We might be dealing with the object we expected, or we might have an
59 // error. We shall assume that a non-200 http status code indicates that something is
60 // wrong.
61 if (response.getStatus() != 200) {
62 throw ERRORS.decode(JSON.toType(string(response), MAP_TYPE));
63 }
64
65 if (Void.class.equals(typeOfT) && input.peek() == END) {
66 return null;
67 }
68
69 input.beginObject();
70
71 while (input.hasNext()) {
72 if ("value".equals(input.nextName())) {
73 return input.read(typeOfT);
74 } else {
75 input.skipValue();
76 }
77 }
78
79 throw new IllegalStateException("Unable to locate value: " + response.contentAsString());
80 } catch (IOException e) {
81 throw new UncheckedIOException(e);
82 }
83 }
84}

Calls 14

toTypeMethod · 0.80
stringMethod · 0.80
hasNextMethod · 0.80
nextNameMethod · 0.80
skipValueMethod · 0.80
readerMethod · 0.65
getStatusMethod · 0.65
decodeMethod · 0.65
readMethod · 0.65
contentAsStringMethod · 0.65
newInputMethod · 0.45
equalsMethod · 0.45