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

Method fromJson

java/src/org/openqa/selenium/bidi/network/Cookie.java:87–146  ·  view source on GitHub ↗
(JsonInput input)

Source from the content-addressed store, hash-verified

85 }
86
87 public static Cookie fromJson(JsonInput input) {
88 String name = null;
89 BytesValue value = null;
90 String domain = null;
91 String path = null;
92 Long size = null;
93 boolean isSecure = false;
94 boolean isHttpOnly = false;
95 SameSite sameSite = null;
96 Optional<Long> expiry = Optional.empty();
97
98 input.beginObject();
99 while (input.hasNext()) {
100 switch (input.nextName()) {
101 case "name":
102 name = input.read(String.class);
103 break;
104 case "value":
105 value = input.read(BytesValue.class);
106 break;
107 case "domain":
108 domain = input.read(String.class);
109 break;
110 case "path":
111 path = input.read(String.class);
112 break;
113 case "size":
114 size = input.read(Long.class);
115 break;
116 case "secure":
117 isSecure = input.readNonNull(Boolean.class);
118 break;
119 case "httpOnly":
120 isHttpOnly = input.readNonNull(Boolean.class);
121 break;
122 case "sameSite":
123 String sameSiteValue = input.readNonNull(String.class);
124 sameSite = SameSite.findByName(sameSiteValue);
125 break;
126 case "expiry":
127 expiry = Optional.of(input.readNonNull(Long.class));
128 break;
129 default:
130 input.skipValue();
131 }
132 }
133
134 input.endObject();
135
136 return new Cookie(
137 Require.nonNull("name", name),
138 Require.nonNull("value", value),
139 domain,
140 path,
141 size,
142 isSecure,
143 isHttpOnly,
144 sameSite,

Callers

nothing calls this directly

Calls 11

findByNameMethod · 0.95
nonNullMethod · 0.95
hasNextMethod · 0.80
nextNameMethod · 0.80
readNonNullMethod · 0.80
skipValueMethod · 0.80
readMethod · 0.65
emptyMethod · 0.45
beginObjectMethod · 0.45
ofMethod · 0.45
endObjectMethod · 0.45

Tested by

no test coverage detected