001package Torello.Browser;
002
003import java.util.*;
004import javax.json.*;
005import javax.json.stream.*;
006import java.io.*;
007
008import java.lang.reflect.Method;
009import java.lang.reflect.Parameter;
010import java.util.function.Function;
011
012import Torello.Java.Additional.*;
013import Torello.Java.JSON.*;
014
015import static Torello.Java.JSON.JFlag.*;
016
017import Torello.Java.StrCmpr;
018import Torello.JavaDoc.StaticFunctional;
019import Torello.JavaDoc.JDHeaderBackgroundImg;
020import Torello.JavaDoc.Excuse;
021
022/**
023 * <SPAN CLASS=COPIEDJDK><B><CODE>[No Description Provided by Google]</CODE></B></SPAN>
024 * 
025 * <EMBED CLASS='external-html' DATA-FILE-ID=CODE_GEN_NOTE>
026 */
027@StaticFunctional(Excused={"counter"}, Excuses={Excuse.CONFIGURATION})
028@JDHeaderBackgroundImg(EmbedTagFileID="WOOD_PLANK_NOTE")
029public class ServiceWorker
030{
031    // ********************************************************************************************
032    // ********************************************************************************************
033    // Class Header Stuff
034    // ********************************************************************************************
035    // ********************************************************************************************
036
037
038    // No Pubic Constructors
039    private ServiceWorker () { }
040
041    // These two Vector's are used by all the "Methods" exported by this class.  java.lang.reflect
042    // is used to generate the JSON String's.  It saves thousands of lines of Auto-Generated Code.
043    private static final Map<String, Vector<String>>    parameterNames = new HashMap<>();
044    private static final Map<String, Vector<Class<?>>>  parameterTypes = new HashMap<>();
045
046    // Some Methods do not take any parameters - for instance all the "enable()" and "disable()"
047    // I simply could not get ride of RAW-TYPES and UNCHECKED warnings... so there are now,
048    // offically, two empty-vectors.  One for String's, and the other for Classes.
049
050    private static final Vector<String>     EMPTY_VEC_STR = new Vector<>();
051    private static final Vector<Class<?>>   EMPTY_VEC_CLASS = new Vector<>();
052
053    static
054    {
055        for (Method m : ServiceWorker.class.getMethods())
056        {
057            // This doesn't work!  The parameter names are all "arg0" ... "argN"
058            // It works for java.lang.reflect.Field, BUT NOT java.lang.reflect.Parameter!
059            //
060            // Vector<String> parameterNamesList = new Vector<>(); -- NOPE!
061
062            Vector<Class<?>> parameterTypesList = new Vector<>();
063        
064            for (Parameter p : m.getParameters()) parameterTypesList.add(p.getType());
065
066            parameterTypes.put(
067                m.getName(),
068                (parameterTypesList.size() > 0) ? parameterTypesList : EMPTY_VEC_CLASS
069            );
070        }
071    }
072
073    static
074    {
075        Vector<String> v = null;
076
077        v = new Vector<String>(3);
078        parameterNames.put("deliverPushMessage", v);
079        Collections.addAll(v, new String[]
080        { "origin", "registrationId", "data", });
081
082        parameterNames.put("disable", EMPTY_VEC_STR);
083
084        v = new Vector<String>(4);
085        parameterNames.put("dispatchSyncEvent", v);
086        Collections.addAll(v, new String[]
087        { "origin", "registrationId", "tag", "lastChance", });
088
089        v = new Vector<String>(3);
090        parameterNames.put("dispatchPeriodicSyncEvent", v);
091        Collections.addAll(v, new String[]
092        { "origin", "registrationId", "tag", });
093
094        parameterNames.put("enable", EMPTY_VEC_STR);
095
096        v = new Vector<String>(1);
097        parameterNames.put("inspectWorker", v);
098        Collections.addAll(v, new String[]
099        { "versionId", });
100
101        v = new Vector<String>(1);
102        parameterNames.put("setForceUpdateOnPageLoad", v);
103        Collections.addAll(v, new String[]
104        { "forceUpdateOnPageLoad", });
105
106        v = new Vector<String>(1);
107        parameterNames.put("skipWaiting", v);
108        Collections.addAll(v, new String[]
109        { "scopeURL", });
110
111        v = new Vector<String>(1);
112        parameterNames.put("startWorker", v);
113        Collections.addAll(v, new String[]
114        { "scopeURL", });
115
116        parameterNames.put("stopAllWorkers", EMPTY_VEC_STR);
117
118        v = new Vector<String>(1);
119        parameterNames.put("stopWorker", v);
120        Collections.addAll(v, new String[]
121        { "versionId", });
122
123        v = new Vector<String>(1);
124        parameterNames.put("unregister", v);
125        Collections.addAll(v, new String[]
126        { "scopeURL", });
127
128        v = new Vector<String>(1);
129        parameterNames.put("updateRegistration", v);
130        Collections.addAll(v, new String[]
131        { "scopeURL", });
132    }
133
134
135    // ********************************************************************************************
136    // ********************************************************************************************
137    // Types - Static Inner Classes
138    // ********************************************************************************************
139    // ********************************************************************************************
140
141    // public static class RegistrationID => String
142    
143    /** <CODE>[No Description Provided by Google]</CODE> */
144    public static final String[] ServiceWorkerVersionRunningStatus =
145    { "stopped", "starting", "running", "stopping", };
146    
147    /** <CODE>[No Description Provided by Google]</CODE> */
148    public static final String[] ServiceWorkerVersionStatus =
149    { "new", "installing", "installed", "activating", "activated", "redundant", };
150    
151    /** ServiceWorker registration. */
152    public static class ServiceWorkerRegistration
153        extends BaseType
154        implements java.io.Serializable
155    {
156        /** For Object Serialization.  java.io.Serializable */
157        protected static final long serialVersionUID = 1;
158        
159        public boolean[] optionals()
160        { return new boolean[] { false, false, false, }; }
161        
162        /** <CODE>[No Description Provided by Google]</CODE> */
163        public final String registrationId;
164        
165        /** <CODE>[No Description Provided by Google]</CODE> */
166        public final String scopeURL;
167        
168        /** <CODE>[No Description Provided by Google]</CODE> */
169        public final boolean isDeleted;
170        
171        /**
172         * Constructor
173         *
174         * @param registrationId -
175         * 
176         * @param scopeURL -
177         * 
178         * @param isDeleted -
179         */
180        public ServiceWorkerRegistration
181            (String registrationId, String scopeURL, boolean isDeleted)
182        {
183            // Exception-Check(s) to ensure that if any parameters which are not declared as
184            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
185            
186            if (registrationId == null) BRDPC.throwNPE("registrationId");
187            if (scopeURL == null)       BRDPC.throwNPE("scopeURL");
188            
189            this.registrationId  = registrationId;
190            this.scopeURL        = scopeURL;
191            this.isDeleted       = isDeleted;
192        }
193        
194        /**
195         * JSON Object Constructor
196         * @param jo A Json-Object having data about an instance of {@code 'ServiceWorkerRegistration'}.
197         */
198        public ServiceWorkerRegistration (JsonObject jo)
199        {
200            this.registrationId  = ReadJSON.getString(jo, "registrationId", false, true);
201            this.scopeURL        = ReadJSON.getString(jo, "scopeURL", false, true);
202            this.isDeleted       = ReadPrimJSON.getBoolean(jo, "isDeleted");
203        }
204        
205        
206        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
207        public boolean equals(Object other)
208        {
209            if (other == null)                       return false;
210            if (other.getClass() != this.getClass()) return false;
211        
212            ServiceWorkerRegistration o = (ServiceWorkerRegistration) other;
213        
214            return
215                    Objects.equals(this.registrationId, o.registrationId)
216                &&  Objects.equals(this.scopeURL, o.scopeURL)
217                &&  (this.isDeleted == o.isDeleted);
218        }
219        
220        /** Generates a Hash-Code for {@code 'this'} instance */
221        public int hashCode()
222        {
223            return
224                    Objects.hashCode(this.registrationId)
225                +   Objects.hashCode(this.scopeURL)
226                +   (this.isDeleted ? 1 : 0);
227        }
228    }
229    
230    /** ServiceWorker version. */
231    public static class ServiceWorkerVersion
232        extends BaseType
233        implements java.io.Serializable
234    {
235        /** For Object Serialization.  java.io.Serializable */
236        protected static final long serialVersionUID = 1;
237        
238        public boolean[] optionals()
239        { return new boolean[] { false, false, false, false, false, true, true, true, true, }; }
240        
241        /** <CODE>[No Description Provided by Google]</CODE> */
242        public final String versionId;
243        
244        /** <CODE>[No Description Provided by Google]</CODE> */
245        public final String registrationId;
246        
247        /** <CODE>[No Description Provided by Google]</CODE> */
248        public final String scriptURL;
249        
250        /** <CODE>[No Description Provided by Google]</CODE> */
251        public final String runningStatus;
252        
253        /** <CODE>[No Description Provided by Google]</CODE> */
254        public final String status;
255        
256        /**
257         * The Last-Modified header value of the main script.
258         * <BR />
259         * <BR /><B>OPTIONAL</B>
260         */
261        public final Number scriptLastModified;
262        
263        /**
264         * The time at which the response headers of the main script were received from the server.
265         * For cached script it is the last time the cache entry was validated.
266         * <BR />
267         * <BR /><B>OPTIONAL</B>
268         */
269        public final Number scriptResponseTime;
270        
271        /**
272         * <CODE>[No Description Provided by Google]</CODE>
273         * <BR />
274         * <BR /><B>OPTIONAL</B>
275         */
276        public final String[] controlledClients;
277        
278        /**
279         * <CODE>[No Description Provided by Google]</CODE>
280         * <BR />
281         * <BR /><B>OPTIONAL</B>
282         */
283        public final String targetId;
284        
285        /**
286         * Constructor
287         *
288         * @param versionId -
289         * 
290         * @param registrationId -
291         * 
292         * @param scriptURL -
293         * 
294         * @param runningStatus -
295         * 
296         * @param status -
297         * 
298         * @param scriptLastModified The Last-Modified header value of the main script.
299         * <BR /><B>OPTIONAL</B>
300         * 
301         * @param scriptResponseTime 
302         * The time at which the response headers of the main script were received from the server.
303         * For cached script it is the last time the cache entry was validated.
304         * <BR /><B>OPTIONAL</B>
305         * 
306         * @param controlledClients -
307         * <BR /><B>OPTIONAL</B>
308         * 
309         * @param targetId -
310         * <BR /><B>OPTIONAL</B>
311         */
312        public ServiceWorkerVersion(
313                String versionId, String registrationId, String scriptURL, String runningStatus, 
314                String status, Number scriptLastModified, Number scriptResponseTime, 
315                String[] controlledClients, String targetId
316            )
317        {
318            // Exception-Check(s) to ensure that if any parameters which are not declared as
319            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
320            
321            if (versionId == null)      BRDPC.throwNPE("versionId");
322            if (registrationId == null) BRDPC.throwNPE("registrationId");
323            if (scriptURL == null)      BRDPC.throwNPE("scriptURL");
324            if (runningStatus == null)  BRDPC.throwNPE("runningStatus");
325            if (status == null)         BRDPC.throwNPE("status");
326            
327            // Exception-Check(s) to ensure that if any parameters which must adhere to a
328            // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw.
329            
330            BRDPC.checkIAE("runningStatus", runningStatus, "ServiceWorker.ServiceWorkerVersionRunningStatus", ServiceWorker.ServiceWorkerVersionRunningStatus);
331            BRDPC.checkIAE("status", status, "ServiceWorker.ServiceWorkerVersionStatus", ServiceWorker.ServiceWorkerVersionStatus);
332            
333            this.versionId           = versionId;
334            this.registrationId      = registrationId;
335            this.scriptURL           = scriptURL;
336            this.runningStatus       = runningStatus;
337            this.status              = status;
338            this.scriptLastModified  = scriptLastModified;
339            this.scriptResponseTime  = scriptResponseTime;
340            this.controlledClients   = controlledClients;
341            this.targetId            = targetId;
342        }
343        
344        /**
345         * JSON Object Constructor
346         * @param jo A Json-Object having data about an instance of {@code 'ServiceWorkerVersion'}.
347         */
348        public ServiceWorkerVersion (JsonObject jo)
349        {
350            this.versionId           = ReadJSON.getString(jo, "versionId", false, true);
351            this.registrationId      = ReadJSON.getString(jo, "registrationId", false, true);
352            this.scriptURL           = ReadJSON.getString(jo, "scriptURL", false, true);
353            this.runningStatus       = ReadJSON.getString(jo, "runningStatus", false, true);
354            this.status              = ReadJSON.getString(jo, "status", false, true);
355            this.scriptLastModified  = ReadNumberJSON.get(jo, "scriptLastModified", true, false);
356            this.scriptResponseTime  = ReadNumberJSON.get(jo, "scriptResponseTime", true, false);
357            this.controlledClients = (jo.getJsonArray("controlledClients") == null)
358                ? null
359                : ReadArrJSON.DimN.strArr(jo.getJsonArray("controlledClients"), null, 0, String[].class);
360        
361            this.targetId            = ReadJSON.getString(jo, "targetId", true, false);
362        }
363        
364        
365        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
366        public boolean equals(Object other)
367        {
368            if (other == null)                       return false;
369            if (other.getClass() != this.getClass()) return false;
370        
371            ServiceWorkerVersion o = (ServiceWorkerVersion) other;
372        
373            return
374                    Objects.equals(this.versionId, o.versionId)
375                &&  Objects.equals(this.registrationId, o.registrationId)
376                &&  Objects.equals(this.scriptURL, o.scriptURL)
377                &&  Objects.equals(this.runningStatus, o.runningStatus)
378                &&  Objects.equals(this.status, o.status)
379                &&  Objects.equals(this.scriptLastModified, o.scriptLastModified)
380                &&  Objects.equals(this.scriptResponseTime, o.scriptResponseTime)
381                &&  Arrays.deepEquals(this.controlledClients, o.controlledClients)
382                &&  Objects.equals(this.targetId, o.targetId);
383        }
384        
385        /** Generates a Hash-Code for {@code 'this'} instance */
386        public int hashCode()
387        {
388            return
389                    Objects.hashCode(this.versionId)
390                +   Objects.hashCode(this.registrationId)
391                +   Objects.hashCode(this.scriptURL)
392                +   Objects.hashCode(this.runningStatus)
393                +   Objects.hashCode(this.status)
394                +   Objects.hashCode(this.scriptLastModified)
395                +   Objects.hashCode(this.scriptResponseTime)
396                +   Arrays.deepHashCode(this.controlledClients)
397                +   Objects.hashCode(this.targetId);
398        }
399    }
400    
401    /** ServiceWorker error message. */
402    public static class ServiceWorkerErrorMessage
403        extends BaseType
404        implements java.io.Serializable
405    {
406        /** For Object Serialization.  java.io.Serializable */
407        protected static final long serialVersionUID = 1;
408        
409        public boolean[] optionals()
410        { return new boolean[] { false, false, false, false, false, false, }; }
411        
412        /** <CODE>[No Description Provided by Google]</CODE> */
413        public final String errorMessage;
414        
415        /** <CODE>[No Description Provided by Google]</CODE> */
416        public final String registrationId;
417        
418        /** <CODE>[No Description Provided by Google]</CODE> */
419        public final String versionId;
420        
421        /** <CODE>[No Description Provided by Google]</CODE> */
422        public final String sourceURL;
423        
424        /** <CODE>[No Description Provided by Google]</CODE> */
425        public final int lineNumber;
426        
427        /** <CODE>[No Description Provided by Google]</CODE> */
428        public final int columnNumber;
429        
430        /**
431         * Constructor
432         *
433         * @param errorMessage -
434         * 
435         * @param registrationId -
436         * 
437         * @param versionId -
438         * 
439         * @param sourceURL -
440         * 
441         * @param lineNumber -
442         * 
443         * @param columnNumber -
444         */
445        public ServiceWorkerErrorMessage(
446                String errorMessage, String registrationId, String versionId, String sourceURL, 
447                int lineNumber, int columnNumber
448            )
449        {
450            // Exception-Check(s) to ensure that if any parameters which are not declared as
451            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
452            
453            if (errorMessage == null)   BRDPC.throwNPE("errorMessage");
454            if (registrationId == null) BRDPC.throwNPE("registrationId");
455            if (versionId == null)      BRDPC.throwNPE("versionId");
456            if (sourceURL == null)      BRDPC.throwNPE("sourceURL");
457            
458            this.errorMessage    = errorMessage;
459            this.registrationId  = registrationId;
460            this.versionId       = versionId;
461            this.sourceURL       = sourceURL;
462            this.lineNumber      = lineNumber;
463            this.columnNumber    = columnNumber;
464        }
465        
466        /**
467         * JSON Object Constructor
468         * @param jo A Json-Object having data about an instance of {@code 'ServiceWorkerErrorMessage'}.
469         */
470        public ServiceWorkerErrorMessage (JsonObject jo)
471        {
472            this.errorMessage    = ReadJSON.getString(jo, "errorMessage", false, true);
473            this.registrationId  = ReadJSON.getString(jo, "registrationId", false, true);
474            this.versionId       = ReadJSON.getString(jo, "versionId", false, true);
475            this.sourceURL       = ReadJSON.getString(jo, "sourceURL", false, true);
476            this.lineNumber      = ReadPrimJSON.getInt(jo, "lineNumber");
477            this.columnNumber    = ReadPrimJSON.getInt(jo, "columnNumber");
478        }
479        
480        
481        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
482        public boolean equals(Object other)
483        {
484            if (other == null)                       return false;
485            if (other.getClass() != this.getClass()) return false;
486        
487            ServiceWorkerErrorMessage o = (ServiceWorkerErrorMessage) other;
488        
489            return
490                    Objects.equals(this.errorMessage, o.errorMessage)
491                &&  Objects.equals(this.registrationId, o.registrationId)
492                &&  Objects.equals(this.versionId, o.versionId)
493                &&  Objects.equals(this.sourceURL, o.sourceURL)
494                &&  (this.lineNumber == o.lineNumber)
495                &&  (this.columnNumber == o.columnNumber);
496        }
497        
498        /** Generates a Hash-Code for {@code 'this'} instance */
499        public int hashCode()
500        {
501            return
502                    Objects.hashCode(this.errorMessage)
503                +   Objects.hashCode(this.registrationId)
504                +   Objects.hashCode(this.versionId)
505                +   Objects.hashCode(this.sourceURL)
506                +   this.lineNumber
507                +   this.columnNumber;
508        }
509    }
510    
511    /** <CODE>[No Description Provided by Google]</CODE> */
512    public static class workerErrorReported
513        extends BrowserEvent
514        implements java.io.Serializable
515    {
516        /** For Object Serialization.  java.io.Serializable */
517        protected static final long serialVersionUID = 1;
518        
519        public boolean[] optionals()
520        { return new boolean[] { false, }; }
521        
522        /** <CODE>[No Description Provided by Google]</CODE> */
523        public final ServiceWorker.ServiceWorkerErrorMessage errorMessage;
524        
525        /**
526         * Constructor
527         *
528         * @param errorMessage -
529         */
530        public workerErrorReported(ServiceWorker.ServiceWorkerErrorMessage errorMessage)
531        {
532            super("ServiceWorker", "workerErrorReported", 1);
533            
534            // Exception-Check(s) to ensure that if any parameters which are not declared as
535            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
536            
537            if (errorMessage == null) BRDPC.throwNPE("errorMessage");
538            
539            this.errorMessage  = errorMessage;
540        }
541        
542        /**
543         * JSON Object Constructor
544         * @param jo A Json-Object having data about an instance of {@code 'workerErrorReported'}.
545         */
546        public workerErrorReported (JsonObject jo)
547        {
548            super("ServiceWorker", "workerErrorReported", 1);
549        
550            this.errorMessage  = ReadJSON.getObject(jo, "errorMessage", ServiceWorker.ServiceWorkerErrorMessage.class, false, true);
551        }
552        
553        
554        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
555        public boolean equals(Object other)
556        {
557            if (other == null)                       return false;
558            if (other.getClass() != this.getClass()) return false;
559        
560            workerErrorReported o = (workerErrorReported) other;
561        
562            return
563                    Objects.equals(this.errorMessage, o.errorMessage);
564        }
565        
566        /** Generates a Hash-Code for {@code 'this'} instance */
567        public int hashCode()
568        {
569            return
570                    this.errorMessage.hashCode();
571        }
572    }
573    
574    /** <CODE>[No Description Provided by Google]</CODE> */
575    public static class workerRegistrationUpdated
576        extends BrowserEvent
577        implements java.io.Serializable
578    {
579        /** For Object Serialization.  java.io.Serializable */
580        protected static final long serialVersionUID = 1;
581        
582        public boolean[] optionals()
583        { return new boolean[] { false, }; }
584        
585        /** <CODE>[No Description Provided by Google]</CODE> */
586        public final ServiceWorker.ServiceWorkerRegistration[] registrations;
587        
588        /**
589         * Constructor
590         *
591         * @param registrations -
592         */
593        public workerRegistrationUpdated
594            (ServiceWorker.ServiceWorkerRegistration[] registrations)
595        {
596            super("ServiceWorker", "workerRegistrationUpdated", 1);
597            
598            // Exception-Check(s) to ensure that if any parameters which are not declared as
599            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
600            
601            if (registrations == null) BRDPC.throwNPE("registrations");
602            
603            this.registrations  = registrations;
604        }
605        
606        /**
607         * JSON Object Constructor
608         * @param jo A Json-Object having data about an instance of {@code 'workerRegistrationUpdated'}.
609         */
610        public workerRegistrationUpdated (JsonObject jo)
611        {
612            super("ServiceWorker", "workerRegistrationUpdated", 1);
613        
614            this.registrations = (jo.getJsonArray("registrations") == null)
615                ? null
616                : ReadArrJSON.DimN.objArr(jo.getJsonArray("registrations"), null, 0, ServiceWorker.ServiceWorkerRegistration[].class);
617        
618        }
619        
620        
621        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
622        public boolean equals(Object other)
623        {
624            if (other == null)                       return false;
625            if (other.getClass() != this.getClass()) return false;
626        
627            workerRegistrationUpdated o = (workerRegistrationUpdated) other;
628        
629            return
630                    Arrays.deepEquals(this.registrations, o.registrations);
631        }
632        
633        /** Generates a Hash-Code for {@code 'this'} instance */
634        public int hashCode()
635        {
636            return
637                    Arrays.deepHashCode(this.registrations);
638        }
639    }
640    
641    /** <CODE>[No Description Provided by Google]</CODE> */
642    public static class workerVersionUpdated
643        extends BrowserEvent
644        implements java.io.Serializable
645    {
646        /** For Object Serialization.  java.io.Serializable */
647        protected static final long serialVersionUID = 1;
648        
649        public boolean[] optionals()
650        { return new boolean[] { false, }; }
651        
652        /** <CODE>[No Description Provided by Google]</CODE> */
653        public final ServiceWorker.ServiceWorkerVersion[] versions;
654        
655        /**
656         * Constructor
657         *
658         * @param versions -
659         */
660        public workerVersionUpdated(ServiceWorker.ServiceWorkerVersion[] versions)
661        {
662            super("ServiceWorker", "workerVersionUpdated", 1);
663            
664            // Exception-Check(s) to ensure that if any parameters which are not declared as
665            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
666            
667            if (versions == null) BRDPC.throwNPE("versions");
668            
669            this.versions  = versions;
670        }
671        
672        /**
673         * JSON Object Constructor
674         * @param jo A Json-Object having data about an instance of {@code 'workerVersionUpdated'}.
675         */
676        public workerVersionUpdated (JsonObject jo)
677        {
678            super("ServiceWorker", "workerVersionUpdated", 1);
679        
680            this.versions = (jo.getJsonArray("versions") == null)
681                ? null
682                : ReadArrJSON.DimN.objArr(jo.getJsonArray("versions"), null, 0, ServiceWorker.ServiceWorkerVersion[].class);
683        
684        }
685        
686        
687        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
688        public boolean equals(Object other)
689        {
690            if (other == null)                       return false;
691            if (other.getClass() != this.getClass()) return false;
692        
693            workerVersionUpdated o = (workerVersionUpdated) other;
694        
695            return
696                    Arrays.deepEquals(this.versions, o.versions);
697        }
698        
699        /** Generates a Hash-Code for {@code 'this'} instance */
700        public int hashCode()
701        {
702            return
703                    Arrays.deepHashCode(this.versions);
704        }
705    }
706    
707    
708    // Counter for keeping the WebSocket Request ID's distinct.
709    private static int counter = 1;
710    
711    /**
712     * <CODE>[No Description Provided by Google]</CODE>
713     * 
714     * @param origin -
715     * 
716     * @param registrationId -
717     * 
718     * @param data -
719     * 
720     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
721     * {@link Ret0}&gt;</CODE>
722     *
723     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
724     * browser receives the invocation-request.
725     *
726     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
727     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
728     * {@code >} to ensure the Browser Function has run to completion.
729     */
730    public static Script<String, JsonObject, Ret0> deliverPushMessage
731        (String origin, String registrationId, String data)
732    {
733        // Exception-Check(s) to ensure that if any parameters which are not declared as
734        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
735        
736        if (origin == null)         BRDPC.throwNPE("origin");
737        if (registrationId == null) BRDPC.throwNPE("registrationId");
738        if (data == null)           BRDPC.throwNPE("data");
739        
740        final int       webSocketID = 36000000 + counter++;
741        final boolean[] optionals   = { false, false, false, };
742        
743        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
744        String requestJSON = WriteJSON.get(
745            parameterTypes.get("deliverPushMessage"),
746            parameterNames.get("deliverPushMessage"),
747            optionals, webSocketID,
748            "ServiceWorker.deliverPushMessage",
749            origin, registrationId, data
750        );
751        
752        // This Remote Command does not have a Return-Value.
753        return new Script<>
754            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
755    }
756    
757    /**
758     * <CODE>[No Description Provided by Google]</CODE>
759     * 
760     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
761     * {@link Ret0}&gt;</CODE>
762     *
763     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
764     * browser receives the invocation-request.
765     *
766     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
767     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
768     * {@code >} to ensure the Browser Function has run to completion.
769     */
770    public static Script<String, JsonObject, Ret0> disable()
771    {
772        final int          webSocketID = 36001000 + counter++;
773        final boolean[]    optionals   = new boolean[0];
774        
775        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
776        String requestJSON = WriteJSON.get(
777            parameterTypes.get("disable"),
778            parameterNames.get("disable"),
779            optionals, webSocketID,
780            "ServiceWorker.disable"
781        );
782        
783        // This Remote Command does not have a Return-Value.
784        return new Script<>
785            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
786    }
787    
788    /**
789     * <CODE>[No Description Provided by Google]</CODE>
790     * 
791     * @param origin -
792     * 
793     * @param registrationId -
794     * 
795     * @param tag -
796     * 
797     * @param lastChance -
798     * 
799     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
800     * {@link Ret0}&gt;</CODE>
801     *
802     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
803     * browser receives the invocation-request.
804     *
805     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
806     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
807     * {@code >} to ensure the Browser Function has run to completion.
808     */
809    public static Script<String, JsonObject, Ret0> dispatchSyncEvent
810        (String origin, String registrationId, String tag, boolean lastChance)
811    {
812        // Exception-Check(s) to ensure that if any parameters which are not declared as
813        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
814        
815        if (origin == null)         BRDPC.throwNPE("origin");
816        if (registrationId == null) BRDPC.throwNPE("registrationId");
817        if (tag == null)            BRDPC.throwNPE("tag");
818        
819        final int       webSocketID = 36002000 + counter++;
820        final boolean[] optionals   = { false, false, false, false, };
821        
822        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
823        String requestJSON = WriteJSON.get(
824            parameterTypes.get("dispatchSyncEvent"),
825            parameterNames.get("dispatchSyncEvent"),
826            optionals, webSocketID,
827            "ServiceWorker.dispatchSyncEvent",
828            origin, registrationId, tag, lastChance
829        );
830        
831        // This Remote Command does not have a Return-Value.
832        return new Script<>
833            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
834    }
835    
836    /**
837     * <CODE>[No Description Provided by Google]</CODE>
838     * 
839     * @param origin -
840     * 
841     * @param registrationId -
842     * 
843     * @param tag -
844     * 
845     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
846     * {@link Ret0}&gt;</CODE>
847     *
848     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
849     * browser receives the invocation-request.
850     *
851     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
852     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
853     * {@code >} to ensure the Browser Function has run to completion.
854     */
855    public static Script<String, JsonObject, Ret0> dispatchPeriodicSyncEvent
856        (String origin, String registrationId, String tag)
857    {
858        // Exception-Check(s) to ensure that if any parameters which are not declared as
859        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
860        
861        if (origin == null)         BRDPC.throwNPE("origin");
862        if (registrationId == null) BRDPC.throwNPE("registrationId");
863        if (tag == null)            BRDPC.throwNPE("tag");
864        
865        final int       webSocketID = 36003000 + counter++;
866        final boolean[] optionals   = { false, false, false, };
867        
868        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
869        String requestJSON = WriteJSON.get(
870            parameterTypes.get("dispatchPeriodicSyncEvent"),
871            parameterNames.get("dispatchPeriodicSyncEvent"),
872            optionals, webSocketID,
873            "ServiceWorker.dispatchPeriodicSyncEvent",
874            origin, registrationId, tag
875        );
876        
877        // This Remote Command does not have a Return-Value.
878        return new Script<>
879            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
880    }
881    
882    /**
883     * <CODE>[No Description Provided by Google]</CODE>
884     * 
885     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
886     * {@link Ret0}&gt;</CODE>
887     *
888     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
889     * browser receives the invocation-request.
890     *
891     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
892     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
893     * {@code >} to ensure the Browser Function has run to completion.
894     */
895    public static Script<String, JsonObject, Ret0> enable()
896    {
897        final int          webSocketID = 36004000 + counter++;
898        final boolean[]    optionals   = new boolean[0];
899        
900        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
901        String requestJSON = WriteJSON.get(
902            parameterTypes.get("enable"),
903            parameterNames.get("enable"),
904            optionals, webSocketID,
905            "ServiceWorker.enable"
906        );
907        
908        // This Remote Command does not have a Return-Value.
909        return new Script<>
910            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
911    }
912    
913    /**
914     * <CODE>[No Description Provided by Google]</CODE>
915     * 
916     * @param versionId -
917     * 
918     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
919     * {@link Ret0}&gt;</CODE>
920     *
921     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
922     * browser receives the invocation-request.
923     *
924     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
925     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
926     * {@code >} to ensure the Browser Function has run to completion.
927     */
928    public static Script<String, JsonObject, Ret0> inspectWorker(String versionId)
929    {
930        // Exception-Check(s) to ensure that if any parameters which are not declared as
931        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
932        
933        if (versionId == null) BRDPC.throwNPE("versionId");
934        
935        final int       webSocketID = 36005000 + counter++;
936        final boolean[] optionals   = { false, };
937        
938        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
939        String requestJSON = WriteJSON.get(
940            parameterTypes.get("inspectWorker"),
941            parameterNames.get("inspectWorker"),
942            optionals, webSocketID,
943            "ServiceWorker.inspectWorker",
944            versionId
945        );
946        
947        // This Remote Command does not have a Return-Value.
948        return new Script<>
949            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
950    }
951    
952    /**
953     * <CODE>[No Description Provided by Google]</CODE>
954     * 
955     * @param forceUpdateOnPageLoad -
956     * 
957     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
958     * {@link Ret0}&gt;</CODE>
959     *
960     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
961     * browser receives the invocation-request.
962     *
963     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
964     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
965     * {@code >} to ensure the Browser Function has run to completion.
966     */
967    public static Script<String, JsonObject, Ret0> setForceUpdateOnPageLoad
968        (boolean forceUpdateOnPageLoad)
969    {
970        final int       webSocketID = 36006000 + counter++;
971        final boolean[] optionals   = { false, };
972        
973        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
974        String requestJSON = WriteJSON.get(
975            parameterTypes.get("setForceUpdateOnPageLoad"),
976            parameterNames.get("setForceUpdateOnPageLoad"),
977            optionals, webSocketID,
978            "ServiceWorker.setForceUpdateOnPageLoad",
979            forceUpdateOnPageLoad
980        );
981        
982        // This Remote Command does not have a Return-Value.
983        return new Script<>
984            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
985    }
986    
987    /**
988     * <CODE>[No Description Provided by Google]</CODE>
989     * 
990     * @param scopeURL -
991     * 
992     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
993     * {@link Ret0}&gt;</CODE>
994     *
995     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
996     * browser receives the invocation-request.
997     *
998     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
999     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
1000     * {@code >} to ensure the Browser Function has run to completion.
1001     */
1002    public static Script<String, JsonObject, Ret0> skipWaiting(String scopeURL)
1003    {
1004        // Exception-Check(s) to ensure that if any parameters which are not declared as
1005        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
1006        
1007        if (scopeURL == null) BRDPC.throwNPE("scopeURL");
1008        
1009        final int       webSocketID = 36007000 + counter++;
1010        final boolean[] optionals   = { false, };
1011        
1012        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
1013        String requestJSON = WriteJSON.get(
1014            parameterTypes.get("skipWaiting"),
1015            parameterNames.get("skipWaiting"),
1016            optionals, webSocketID,
1017            "ServiceWorker.skipWaiting",
1018            scopeURL
1019        );
1020        
1021        // This Remote Command does not have a Return-Value.
1022        return new Script<>
1023            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
1024    }
1025    
1026    /**
1027     * <CODE>[No Description Provided by Google]</CODE>
1028     * 
1029     * @param scopeURL -
1030     * 
1031     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
1032     * {@link Ret0}&gt;</CODE>
1033     *
1034     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
1035     * browser receives the invocation-request.
1036     *
1037     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
1038     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
1039     * {@code >} to ensure the Browser Function has run to completion.
1040     */
1041    public static Script<String, JsonObject, Ret0> startWorker(String scopeURL)
1042    {
1043        // Exception-Check(s) to ensure that if any parameters which are not declared as
1044        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
1045        
1046        if (scopeURL == null) BRDPC.throwNPE("scopeURL");
1047        
1048        final int       webSocketID = 36008000 + counter++;
1049        final boolean[] optionals   = { false, };
1050        
1051        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
1052        String requestJSON = WriteJSON.get(
1053            parameterTypes.get("startWorker"),
1054            parameterNames.get("startWorker"),
1055            optionals, webSocketID,
1056            "ServiceWorker.startWorker",
1057            scopeURL
1058        );
1059        
1060        // This Remote Command does not have a Return-Value.
1061        return new Script<>
1062            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
1063    }
1064    
1065    /**
1066     * <CODE>[No Description Provided by Google]</CODE>
1067     * 
1068     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
1069     * {@link Ret0}&gt;</CODE>
1070     *
1071     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
1072     * browser receives the invocation-request.
1073     *
1074     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
1075     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
1076     * {@code >} to ensure the Browser Function has run to completion.
1077     */
1078    public static Script<String, JsonObject, Ret0> stopAllWorkers()
1079    {
1080        final int          webSocketID = 36009000 + counter++;
1081        final boolean[]    optionals   = new boolean[0];
1082        
1083        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
1084        String requestJSON = WriteJSON.get(
1085            parameterTypes.get("stopAllWorkers"),
1086            parameterNames.get("stopAllWorkers"),
1087            optionals, webSocketID,
1088            "ServiceWorker.stopAllWorkers"
1089        );
1090        
1091        // This Remote Command does not have a Return-Value.
1092        return new Script<>
1093            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
1094    }
1095    
1096    /**
1097     * <CODE>[No Description Provided by Google]</CODE>
1098     * 
1099     * @param versionId -
1100     * 
1101     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
1102     * {@link Ret0}&gt;</CODE>
1103     *
1104     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
1105     * browser receives the invocation-request.
1106     *
1107     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
1108     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
1109     * {@code >} to ensure the Browser Function has run to completion.
1110     */
1111    public static Script<String, JsonObject, Ret0> stopWorker(String versionId)
1112    {
1113        // Exception-Check(s) to ensure that if any parameters which are not declared as
1114        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
1115        
1116        if (versionId == null) BRDPC.throwNPE("versionId");
1117        
1118        final int       webSocketID = 36010000 + counter++;
1119        final boolean[] optionals   = { false, };
1120        
1121        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
1122        String requestJSON = WriteJSON.get(
1123            parameterTypes.get("stopWorker"),
1124            parameterNames.get("stopWorker"),
1125            optionals, webSocketID,
1126            "ServiceWorker.stopWorker",
1127            versionId
1128        );
1129        
1130        // This Remote Command does not have a Return-Value.
1131        return new Script<>
1132            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
1133    }
1134    
1135    /**
1136     * <CODE>[No Description Provided by Google]</CODE>
1137     * 
1138     * @param scopeURL -
1139     * 
1140     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
1141     * {@link Ret0}&gt;</CODE>
1142     *
1143     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
1144     * browser receives the invocation-request.
1145     *
1146     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
1147     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
1148     * {@code >} to ensure the Browser Function has run to completion.
1149     */
1150    public static Script<String, JsonObject, Ret0> unregister(String scopeURL)
1151    {
1152        // Exception-Check(s) to ensure that if any parameters which are not declared as
1153        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
1154        
1155        if (scopeURL == null) BRDPC.throwNPE("scopeURL");
1156        
1157        final int       webSocketID = 36011000 + counter++;
1158        final boolean[] optionals   = { false, };
1159        
1160        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
1161        String requestJSON = WriteJSON.get(
1162            parameterTypes.get("unregister"),
1163            parameterNames.get("unregister"),
1164            optionals, webSocketID,
1165            "ServiceWorker.unregister",
1166            scopeURL
1167        );
1168        
1169        // This Remote Command does not have a Return-Value.
1170        return new Script<>
1171            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
1172    }
1173    
1174    /**
1175     * <CODE>[No Description Provided by Google]</CODE>
1176     * 
1177     * @param scopeURL -
1178     * 
1179     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
1180     * {@link Ret0}&gt;</CODE>
1181     *
1182     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
1183     * browser receives the invocation-request.
1184     *
1185     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
1186     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
1187     * {@code >} to ensure the Browser Function has run to completion.
1188     */
1189    public static Script<String, JsonObject, Ret0> updateRegistration(String scopeURL)
1190    {
1191        // Exception-Check(s) to ensure that if any parameters which are not declared as
1192        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
1193        
1194        if (scopeURL == null) BRDPC.throwNPE("scopeURL");
1195        
1196        final int       webSocketID = 36012000 + counter++;
1197        final boolean[] optionals   = { false, };
1198        
1199        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
1200        String requestJSON = WriteJSON.get(
1201            parameterTypes.get("updateRegistration"),
1202            parameterNames.get("updateRegistration"),
1203            optionals, webSocketID,
1204            "ServiceWorker.updateRegistration",
1205            scopeURL
1206        );
1207        
1208        // This Remote Command does not have a Return-Value.
1209        return new Script<>
1210            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
1211    }
1212    
1213}