1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394 | package Torello.Browser.BrowserAPI.NestedHelpers.Types;
import static Torello.Browser.CDPTypes.*;
import Torello.JSON.*;
import Torello.Java.ReadOnly.*;
import Torello.Browser.*;
import Torello.Browser.BrowserAPI.*;
import Torello.Browser.JavaScriptAPI.*;
import Torello.Browser.helper.*;
import javax.json.JsonObject;
import javax.json.stream.JsonGenerator;
import java.util.Objects;
import java.util.Arrays;
import java.util.stream.IntStream;
public class Page$$Frame$$
implements NestedHelper<Page.Frame>
{
// ********************************************************************************************
// ********************************************************************************************
// Constructor, Singleton & "Reflection"
// ********************************************************************************************
// ********************************************************************************************
// Simple Constructor, used *ONLY* to construct the singleton instance, directly below
private Page$$Frame$$() { }
// Single Instance of this class. How all the instance methods are invoked, statically
public static final Page$$Frame$$ singleton = new Page$$Frame$$();
// Pointer / Reference to the Domain's Nested-Class which is being 'helped' by this class.
public static final Class<Page.Frame> baseTypeClass =
Page.Frame.class;
// Stores simple Reflection Information about Page.Frame
public static final NestedDescriptor<Page.Frame> descriptor;
static
{
// The names of each field in this helper class
final ReadOnlyList<String> names = new ReadOnlyArrayList<>(
String.class, "id", "parentId", "loaderId", "name", "url", "urlFragment",
"domainAndRegistry", "securityOrigin", "securityOriginDetails", "mimeType",
"unreachableUrl", "adFrameStatus", "secureContextType",
"crossOriginIsolatedContextType", "gatedAPIFeatures"
);
// Type of each field, stored using the constants in Torello.Browser.CDPTypes
final ReadOnlyList<Byte> types = new ReadOnlyArrayList<>(
Byte.class, STRING, STRING, STRING, STRING, STRING, STRING, STRING, STRING, CDP_TYPE,
STRING, STRING, CDP_TYPE, STRING, STRING, STRING_ARRAY_1D
);
// Whether each field is optional or not, as defined in Google's CDP Specs
final ReadOnlyList<Boolean> optionals = new ReadOnlyArrayList<>(
Boolean.class, false, true, false, true, false, true, false, false, true, false, true,
true, false, false, false
);
// Whether each field is experimental or not, as defined in Google's CDP Specs
final ReadOnlyList<Boolean> experimentals = new ReadOnlyArrayList<>(
Boolean.class, false, false, false, false, false, true, true, false, true, false, true,
true, true, true, true
);
descriptor = new NestedDescriptor<>
(Domains.Page, "Frame", names, types, optionals, experimentals, baseTypeClass);
}
// ********************************************************************************************
// ********************************************************************************************
// Simple Getters & Helpers
// ********************************************************************************************
// ********************************************************************************************
// Can be used to generate an instance using the advanced 'TypeBuilder' class
public NestedDescriptor<Page.Frame> descriptor()
{ return descriptor; }
// Build the 'isPresent' read-only list using the class' current assigned values
public ReadOnlyList<Boolean> generateIsPresentList(final Page.Frame THIS)
{
return new ReadOnlyArrayList<>(
Boolean.class,
THIS.id == null,
THIS.parentId == null,
THIS.loaderId == null,
THIS.name == null,
THIS.url == null,
THIS.urlFragment == null,
THIS.domainAndRegistry == null,
THIS.securityOrigin == null,
THIS.securityOriginDetails == null,
THIS.mimeType == null,
THIS.unreachableUrl == null,
THIS.adFrameStatus == null,
THIS.secureContextType == null,
THIS.crossOriginIsolatedContextType == null,
THIS.gatedAPIFeatures == null
);
}
// ********************************************************************************************
// ********************************************************************************************
// java.lang.Object Methods
// ********************************************************************************************
// ********************************************************************************************
// Checks whether 'THIS' equals an input Java-Object
public boolean equals(final Page.Frame THIS, final Object OTHER)
{
if (THIS == OTHER) return true;
if (OTHER == null) return false;
// This equals expects that the instance be of the exact class
if (OTHER.getClass() != Page.Frame.class) return false;
final Page.Frame O = (Page.Frame) OTHER;
return
Objects.equals(THIS.id, O.id)
&& Objects.equals(THIS.parentId, O.parentId)
&& Objects.equals(THIS.loaderId, O.loaderId)
&& Objects.equals(THIS.name, O.name)
&& Objects.equals(THIS.url, O.url)
&& Objects.equals(THIS.urlFragment, O.urlFragment)
&& Objects.equals(THIS.domainAndRegistry, O.domainAndRegistry)
&& Objects.equals(THIS.securityOrigin, O.securityOrigin)
&& Objects.equals(THIS.securityOriginDetails, O.securityOriginDetails)
&& Objects.equals(THIS.mimeType, O.mimeType)
&& Objects.equals(THIS.unreachableUrl, O.unreachableUrl)
&& Objects.equals(THIS.adFrameStatus, O.adFrameStatus)
&& Objects.equals(THIS.secureContextType, O.secureContextType)
&& Objects.equals(THIS.crossOriginIsolatedContextType, O.crossOriginIsolatedContextType)
&& Arrays.equals(THIS.gatedAPIFeatures, O.gatedAPIFeatures);
}
// Generates a Hash-Code for 'THIS' instance
public int hashCode(final Page.Frame THIS)
{
return
((THIS.id == null) ? 0 : THIS.id.hashCode())
+ ((THIS.parentId == null) ? 0 : THIS.parentId.hashCode())
+ ((THIS.loaderId == null) ? 0 : THIS.loaderId.hashCode())
+ ((THIS.name == null) ? 0 : THIS.name.hashCode())
+ ((THIS.url == null) ? 0 : THIS.url.hashCode())
+ ((THIS.urlFragment == null) ? 0 : THIS.urlFragment.hashCode())
+ ((THIS.domainAndRegistry == null) ? 0 : THIS.domainAndRegistry.hashCode())
+ ((THIS.securityOrigin == null) ? 0 : THIS.securityOrigin.hashCode())
+ Objects.hashCode(THIS.securityOriginDetails)
+ ((THIS.mimeType == null) ? 0 : THIS.mimeType.hashCode())
+ ((THIS.unreachableUrl == null) ? 0 : THIS.unreachableUrl.hashCode())
+ Objects.hashCode(THIS.adFrameStatus)
+ ((THIS.secureContextType == null) ? 0 : THIS.secureContextType.hashCode())
+ ((THIS.crossOriginIsolatedContextType == null) ? 0 : THIS.crossOriginIsolatedContextType.hashCode())
+ ((THIS.gatedAPIFeatures == null) ? 0 : Arrays.hashCode(THIS.gatedAPIFeatures));
}
// ********************************************************************************************
// ********************************************************************************************
// Json Methods
// ********************************************************************************************
// ********************************************************************************************
// Converts this instance to JSON
public void toJSON(
final Page.Frame THIS,
final String name,
final JsonGenerator jGen
)
{
final ReadOnlyList<Boolean> isPresent = THIS.isPresent();
if (name != null) jGen.writeStartObject(name);
else jGen.writeStartObject();
if (isPresent.get(0))
{
// Writing Type: String (CDPTypes.STRING), *IS NOT* optional
if (THIS.id == null) jGen.writeNull();
else jGen.write("id", THIS.id);
}
if (isPresent.get(1))
{
// Writing Type: String (CDPTypes.STRING), *IS* optional
if (THIS.parentId == null) jGen.writeNull();
else jGen.write("parentId", THIS.parentId);
}
if (isPresent.get(2))
{
// Writing Type: String (CDPTypes.STRING), *IS NOT* optional
if (THIS.loaderId == null) jGen.writeNull();
else jGen.write("loaderId", THIS.loaderId);
}
if (isPresent.get(3))
{
// Writing Type: String (CDPTypes.STRING), *IS* optional
if (THIS.name == null) jGen.writeNull();
else jGen.write("name", THIS.name);
}
if (isPresent.get(4))
{
// Writing Type: String (CDPTypes.STRING), *IS NOT* optional
if (THIS.url == null) jGen.writeNull();
else jGen.write("url", THIS.url);
}
if (isPresent.get(5))
{
// Writing Type: String (CDPTypes.STRING), *IS* optional
if (THIS.urlFragment == null) jGen.writeNull();
else jGen.write("urlFragment", THIS.urlFragment);
}
if (isPresent.get(6))
{
// Writing Type: String (CDPTypes.STRING), *IS NOT* optional
if (THIS.domainAndRegistry == null) jGen.writeNull();
else jGen.write("domainAndRegistry", THIS.domainAndRegistry);
}
if (isPresent.get(7))
{
// Writing Type: String (CDPTypes.STRING), *IS NOT* optional
if (THIS.securityOrigin == null) jGen.writeNull();
else jGen.write("securityOrigin", THIS.securityOrigin);
}
if (isPresent.get(8))
{
// Writing Type: Page.SecurityOriginDetails (CDPTypes.CDP_TYPE), *IS* optional
if (THIS.securityOriginDetails == null) jGen.writeNull();
else THIS.securityOriginDetails.toJSON("securityOriginDetails", jGen);
}
if (isPresent.get(9))
{
// Writing Type: String (CDPTypes.STRING), *IS NOT* optional
if (THIS.mimeType == null) jGen.writeNull();
else jGen.write("mimeType", THIS.mimeType);
}
if (isPresent.get(10))
{
// Writing Type: String (CDPTypes.STRING), *IS* optional
if (THIS.unreachableUrl == null) jGen.writeNull();
else jGen.write("unreachableUrl", THIS.unreachableUrl);
}
if (isPresent.get(11))
{
// Writing Type: Page.AdFrameStatus (CDPTypes.CDP_TYPE), *IS* optional
if (THIS.adFrameStatus == null) jGen.writeNull();
else THIS.adFrameStatus.toJSON("adFrameStatus", jGen);
}
if (isPresent.get(12))
{
// Writing Type: String (CDPTypes.STRING), *IS NOT* optional
if (THIS.secureContextType == null) jGen.writeNull();
else jGen.write("secureContextType", THIS.secureContextType);
}
if (isPresent.get(13))
{
// Writing Type: String (CDPTypes.STRING), *IS NOT* optional
if (THIS.crossOriginIsolatedContextType == null) jGen.writeNull();
else jGen.write("crossOriginIsolatedContextType", THIS.crossOriginIsolatedContextType);
}
if (isPresent.get(14))
{
// Writing Type: String[] (CDPTypes.STRING_ARRAY_1D), *IS NOT* optional
if (THIS.gatedAPIFeatures == null) jGen.writeNull();
else
{
jGen.writeStartArray("gatedAPIFeatures");
for (final String s : THIS.gatedAPIFeatures)
if (s == null) jGen.writeNull();
else jGen.write(s);
jGen.writeEnd();
}
}
}
// Generates an instance of this class, using a JsonObject as input
public Page.Frame fromJSON(final JsonObject jo)
{
final ReadOnlyList<Boolean> isPresent = new ReadOnlyArrayList<>(
Boolean.class,
jo.containsKey("id"),
jo.containsKey("parentId"),
jo.containsKey("loaderId"),
jo.containsKey("name"),
jo.containsKey("url"),
jo.containsKey("urlFragment"),
jo.containsKey("domainAndRegistry"),
jo.containsKey("securityOrigin"),
jo.containsKey("securityOriginDetails"),
jo.containsKey("mimeType"),
jo.containsKey("unreachableUrl"),
jo.containsKey("adFrameStatus"),
jo.containsKey("secureContextType"),
jo.containsKey("crossOriginIsolatedContextType"),
jo.containsKey("gatedAPIFeatures")
);
return new Page.Frame(
isPresent,
ReadJSON.getString(jo, "id", true, false),
ReadJSON.getString(jo, "parentId", true, false),
ReadJSON.getString(jo, "loaderId", true, false),
ReadJSON.getString(jo, "name", true, false),
ReadJSON.getString(jo, "url", true, false),
ReadJSON.getString(jo, "urlFragment", true, false),
ReadJSON.getString(jo, "domainAndRegistry", true, false),
ReadJSON.getString(jo, "securityOrigin", true, false),
ReadJSON.getObject(
jo, "securityOriginDetails",
Page.SecurityOriginDetails::fromJSON,
Page.SecurityOriginDetails.class,
true, false
),
ReadJSON.getString(jo, "mimeType", true, false),
ReadJSON.getString(jo, "unreachableUrl", true, false),
ReadJSON.getObject(
jo, "adFrameStatus",
Page.AdFrameStatus::fromJSON,
Page.AdFrameStatus.class,
true, false
),
ReadJSON.getString(jo, "secureContextType", true, false),
ReadJSON.getString(jo, "crossOriginIsolatedContextType", true, false),
(isPresent.get(14) == false)
? null
: RJArrIntoStream
.strArr(jo.getJsonArray("gatedAPIFeatures"), null, 0)
.toArray(String[]::new)
);
}
// ********************************************************************************************
// ********************************************************************************************
// Enumerated String Constant Fields' Issues
// ********************************************************************************************
// ********************************************************************************************
private static final ReadOnlyMap<String, ReadOnlyList<String>> allEnumStrs;
static
{
final ROTreeMapBuilder<String, ReadOnlyList<String>> rotmb = new ROTreeMapBuilder<>();
rotmb.put("secureContextType", Page.SecureContextType);
rotmb.put("crossOriginIsolatedContextType", Page.CrossOriginIsolatedContextType);
rotmb.put("gatedAPIFeatures", Page.GatedAPIFeatures);
allEnumStrs = rotmb.build();
}
// Utilized by abstract ancestor 'BaseType'
public ReadOnlyMap<String, ReadOnlyList<String>> allEnumStrROLs()
{ return allEnumStrs; }
// Checks all string fields, whose values are limited to an enumerated set
public IntStream enumStrValidate(final Page.Frame THIS)
{
final IntStream.Builder b = IntStream.builder();
if (! Page.SecureContextType.contains(THIS.secureContextType)) b.accept(12);
if (! Page.CrossOriginIsolatedContextType.contains(THIS.crossOriginIsolatedContextType)) b.accept(13);
if (! Page.GatedAPIFeatures.containsAND((Object[]) THIS.gatedAPIFeatures)) b.accept(14);
return b.build();
}
}
|