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) THROWS.throwNPE("registrationId");
187            if (scopeURL == null)       THROWS.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 (this == other)                       return true;
210            if (other == null)                       return false;
211            if (other.getClass() != this.getClass()) return false;
212        
213            ServiceWorkerRegistration o = (ServiceWorkerRegistration) other;
214        
215            return
216                    Objects.equals(this.registrationId, o.registrationId)
217                &&  Objects.equals(this.scopeURL, o.scopeURL)
218                &&  (this.isDeleted == o.isDeleted);
219        }
220        
221        /** Generates a Hash-Code for {@code 'this'} instance */
222        public int hashCode()
223        {
224            return
225                    Objects.hashCode(this.registrationId)
226                +   Objects.hashCode(this.scopeURL)
227                +   (this.isDeleted ? 1 : 0);
228        }
229    }
230    
231    /** ServiceWorker version. */
232    public static class ServiceWorkerVersion
233        extends BaseType
234        implements java.io.Serializable
235    {
236        /** For Object Serialization.  java.io.Serializable */
237        protected static final long serialVersionUID = 1;
238        
239        public boolean[] optionals()
240        { return new boolean[] { false, false, false, false, false, true, true, true, true, }; }
241        
242        /** <CODE>[No Description Provided by Google]</CODE> */
243        public final String versionId;
244        
245        /** <CODE>[No Description Provided by Google]</CODE> */
246        public final String registrationId;
247        
248        /** <CODE>[No Description Provided by Google]</CODE> */
249        public final String scriptURL;
250        
251        /** <CODE>[No Description Provided by Google]</CODE> */
252        public final String runningStatus;
253        
254        /** <CODE>[No Description Provided by Google]</CODE> */
255        public final String status;
256        
257        /**
258         * The Last-Modified header value of the main script.
259         * <BR />
260         * <BR /><B>OPTIONAL</B>
261         */
262        public final Number scriptLastModified;
263        
264        /**
265         * The time at which the response headers of the main script were received from the server.
266         * For cached script it is the last time the cache entry was validated.
267         * <BR />
268         * <BR /><B>OPTIONAL</B>
269         */
270        public final Number scriptResponseTime;
271        
272        /**
273         * <CODE>[No Description Provided by Google]</CODE>
274         * <BR />
275         * <BR /><B>OPTIONAL</B>
276         */
277        public final String[] controlledClients;
278        
279        /**
280         * <CODE>[No Description Provided by Google]</CODE>
281         * <BR />
282         * <BR /><B>OPTIONAL</B>
283         */
284        public final String targetId;
285        
286        /**
287         * Constructor
288         *
289         * @param versionId -
290         * 
291         * @param registrationId -
292         * 
293         * @param scriptURL -
294         * 
295         * @param runningStatus -
296         * 
297         * @param status -
298         * 
299         * @param scriptLastModified The Last-Modified header value of the main script.
300         * <BR /><B>OPTIONAL</B>
301         * 
302         * @param scriptResponseTime 
303         * The time at which the response headers of the main script were received from the server.
304         * For cached script it is the last time the cache entry was validated.
305         * <BR /><B>OPTIONAL</B>
306         * 
307         * @param controlledClients -
308         * <BR /><B>OPTIONAL</B>
309         * 
310         * @param targetId -
311         * <BR /><B>OPTIONAL</B>
312         */
313        public ServiceWorkerVersion(
314                String versionId, String registrationId, String scriptURL, String runningStatus, 
315                String status, Number scriptLastModified, Number scriptResponseTime, 
316                String[] controlledClients, String targetId
317            )
318        {
319            // Exception-Check(s) to ensure that if any parameters which are not declared as
320            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
321            
322            if (versionId == null)      THROWS.throwNPE("versionId");
323            if (registrationId == null) THROWS.throwNPE("registrationId");
324            if (scriptURL == null)      THROWS.throwNPE("scriptURL");
325            if (runningStatus == null)  THROWS.throwNPE("runningStatus");
326            if (status == null)         THROWS.throwNPE("status");
327            
328            // Exception-Check(s) to ensure that if any parameters which must adhere to a
329            // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw.
330            
331            THROWS.checkIAE("runningStatus", runningStatus, "ServiceWorker.ServiceWorkerVersionRunningStatus", ServiceWorker.ServiceWorkerVersionRunningStatus);
332            THROWS.checkIAE("status", status, "ServiceWorker.ServiceWorkerVersionStatus", ServiceWorker.ServiceWorkerVersionStatus);
333            
334            this.versionId           = versionId;
335            this.registrationId      = registrationId;
336            this.scriptURL           = scriptURL;
337            this.runningStatus       = runningStatus;
338            this.status              = status;
339            this.scriptLastModified  = scriptLastModified;
340            this.scriptResponseTime  = scriptResponseTime;
341            this.controlledClients   = controlledClients;
342            this.targetId            = targetId;
343        }
344        
345        /**
346         * JSON Object Constructor
347         * @param jo A Json-Object having data about an instance of {@code 'ServiceWorkerVersion'}.
348         */
349        public ServiceWorkerVersion (JsonObject jo)
350        {
351            this.versionId           = ReadJSON.getString(jo, "versionId", false, true);
352            this.registrationId      = ReadJSON.getString(jo, "registrationId", false, true);
353            this.scriptURL           = ReadJSON.getString(jo, "scriptURL", false, true);
354            this.runningStatus       = ReadJSON.getString(jo, "runningStatus", false, true);
355            this.status              = ReadJSON.getString(jo, "status", false, true);
356            this.scriptLastModified  = ReadNumberJSON.get(jo, "scriptLastModified", true, false);
357            this.scriptResponseTime  = ReadNumberJSON.get(jo, "scriptResponseTime", true, false);
358            this.controlledClients = (jo.getJsonArray("controlledClients") == null)
359                ? null
360                : RJArrIntoStream.strArr(jo.getJsonArray("controlledClients"), null, 0).toArray(String[]::new);
361        
362            this.targetId            = ReadJSON.getString(jo, "targetId", true, false);
363        }
364        
365        
366        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
367        public boolean equals(Object other)
368        {
369            if (this == other)                       return true;
370            if (other == null)                       return false;
371            if (other.getClass() != this.getClass()) return false;
372        
373            ServiceWorkerVersion o = (ServiceWorkerVersion) other;
374        
375            return
376                    Objects.equals(this.versionId, o.versionId)
377                &&  Objects.equals(this.registrationId, o.registrationId)
378                &&  Objects.equals(this.scriptURL, o.scriptURL)
379                &&  Objects.equals(this.runningStatus, o.runningStatus)
380                &&  Objects.equals(this.status, o.status)
381                &&  Objects.equals(this.scriptLastModified, o.scriptLastModified)
382                &&  Objects.equals(this.scriptResponseTime, o.scriptResponseTime)
383                &&  Arrays.deepEquals(this.controlledClients, o.controlledClients)
384                &&  Objects.equals(this.targetId, o.targetId);
385        }
386        
387        /** Generates a Hash-Code for {@code 'this'} instance */
388        public int hashCode()
389        {
390            return
391                    Objects.hashCode(this.versionId)
392                +   Objects.hashCode(this.registrationId)
393                +   Objects.hashCode(this.scriptURL)
394                +   Objects.hashCode(this.runningStatus)
395                +   Objects.hashCode(this.status)
396                +   Objects.hashCode(this.scriptLastModified)
397                +   Objects.hashCode(this.scriptResponseTime)
398                +   Arrays.deepHashCode(this.controlledClients)
399                +   Objects.hashCode(this.targetId);
400        }
401    }
402    
403    /** ServiceWorker error message. */
404    public static class ServiceWorkerErrorMessage
405        extends BaseType
406        implements java.io.Serializable
407    {
408        /** For Object Serialization.  java.io.Serializable */
409        protected static final long serialVersionUID = 1;
410        
411        public boolean[] optionals()
412        { return new boolean[] { false, false, false, false, false, false, }; }
413        
414        /** <CODE>[No Description Provided by Google]</CODE> */
415        public final String errorMessage;
416        
417        /** <CODE>[No Description Provided by Google]</CODE> */
418        public final String registrationId;
419        
420        /** <CODE>[No Description Provided by Google]</CODE> */
421        public final String versionId;
422        
423        /** <CODE>[No Description Provided by Google]</CODE> */
424        public final String sourceURL;
425        
426        /** <CODE>[No Description Provided by Google]</CODE> */
427        public final int lineNumber;
428        
429        /** <CODE>[No Description Provided by Google]</CODE> */
430        public final int columnNumber;
431        
432        /**
433         * Constructor
434         *
435         * @param errorMessage -
436         * 
437         * @param registrationId -
438         * 
439         * @param versionId -
440         * 
441         * @param sourceURL -
442         * 
443         * @param lineNumber -
444         * 
445         * @param columnNumber -
446         */
447        public ServiceWorkerErrorMessage(
448                String errorMessage, String registrationId, String versionId, String sourceURL, 
449                int lineNumber, int columnNumber
450            )
451        {
452            // Exception-Check(s) to ensure that if any parameters which are not declared as
453            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
454            
455            if (errorMessage == null)   THROWS.throwNPE("errorMessage");
456            if (registrationId == null) THROWS.throwNPE("registrationId");
457            if (versionId == null)      THROWS.throwNPE("versionId");
458            if (sourceURL == null)      THROWS.throwNPE("sourceURL");
459            
460            this.errorMessage    = errorMessage;
461            this.registrationId  = registrationId;
462            this.versionId       = versionId;
463            this.sourceURL       = sourceURL;
464            this.lineNumber      = lineNumber;
465            this.columnNumber    = columnNumber;
466        }
467        
468        /**
469         * JSON Object Constructor
470         * @param jo A Json-Object having data about an instance of {@code 'ServiceWorkerErrorMessage'}.
471         */
472        public ServiceWorkerErrorMessage (JsonObject jo)
473        {
474            this.errorMessage    = ReadJSON.getString(jo, "errorMessage", false, true);
475            this.registrationId  = ReadJSON.getString(jo, "registrationId", false, true);
476            this.versionId       = ReadJSON.getString(jo, "versionId", false, true);
477            this.sourceURL       = ReadJSON.getString(jo, "sourceURL", false, true);
478            this.lineNumber      = ReadPrimJSON.getInt(jo, "lineNumber");
479            this.columnNumber    = ReadPrimJSON.getInt(jo, "columnNumber");
480        }
481        
482        
483        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
484        public boolean equals(Object other)
485        {
486            if (this == other)                       return true;
487            if (other == null)                       return false;
488            if (other.getClass() != this.getClass()) return false;
489        
490            ServiceWorkerErrorMessage o = (ServiceWorkerErrorMessage) other;
491        
492            return
493                    Objects.equals(this.errorMessage, o.errorMessage)
494                &&  Objects.equals(this.registrationId, o.registrationId)
495                &&  Objects.equals(this.versionId, o.versionId)
496                &&  Objects.equals(this.sourceURL, o.sourceURL)
497                &&  (this.lineNumber == o.lineNumber)
498                &&  (this.columnNumber == o.columnNumber);
499        }
500        
501        /** Generates a Hash-Code for {@code 'this'} instance */
502        public int hashCode()
503        {
504            return
505                    Objects.hashCode(this.errorMessage)
506                +   Objects.hashCode(this.registrationId)
507                +   Objects.hashCode(this.versionId)
508                +   Objects.hashCode(this.sourceURL)
509                +   this.lineNumber
510                +   this.columnNumber;
511        }
512    }
513    
514    /** <CODE>[No Description Provided by Google]</CODE> */
515    public static class workerErrorReported
516        extends BrowserEvent
517        implements java.io.Serializable
518    {
519        /** For Object Serialization.  java.io.Serializable */
520        protected static final long serialVersionUID = 1;
521        
522        public boolean[] optionals()
523        { return new boolean[] { false, }; }
524        
525        /** <CODE>[No Description Provided by Google]</CODE> */
526        public final ServiceWorker.ServiceWorkerErrorMessage errorMessage;
527        
528        /**
529         * Constructor
530         *
531         * @param errorMessage -
532         */
533        public workerErrorReported(ServiceWorker.ServiceWorkerErrorMessage errorMessage)
534        {
535            super("ServiceWorker", "workerErrorReported", 1);
536            
537            // Exception-Check(s) to ensure that if any parameters which are not declared as
538            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
539            
540            if (errorMessage == null) THROWS.throwNPE("errorMessage");
541            
542            this.errorMessage  = errorMessage;
543        }
544        
545        /**
546         * JSON Object Constructor
547         * @param jo A Json-Object having data about an instance of {@code 'workerErrorReported'}.
548         */
549        public workerErrorReported (JsonObject jo)
550        {
551            super("ServiceWorker", "workerErrorReported", 1);
552        
553            this.errorMessage  = ReadJSON.getObject(jo, "errorMessage", ServiceWorker.ServiceWorkerErrorMessage.class, false, true);
554        }
555        
556        
557        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
558        public boolean equals(Object other)
559        {
560            if (this == other)                       return true;
561            if (other == null)                       return false;
562            if (other.getClass() != this.getClass()) return false;
563        
564            workerErrorReported o = (workerErrorReported) other;
565        
566            return
567                    Objects.equals(this.errorMessage, o.errorMessage);
568        }
569        
570        /** Generates a Hash-Code for {@code 'this'} instance */
571        public int hashCode()
572        {
573            return
574                    this.errorMessage.hashCode();
575        }
576    }
577    
578    /** <CODE>[No Description Provided by Google]</CODE> */
579    public static class workerRegistrationUpdated
580        extends BrowserEvent
581        implements java.io.Serializable
582    {
583        /** For Object Serialization.  java.io.Serializable */
584        protected static final long serialVersionUID = 1;
585        
586        public boolean[] optionals()
587        { return new boolean[] { false, }; }
588        
589        /** <CODE>[No Description Provided by Google]</CODE> */
590        public final ServiceWorker.ServiceWorkerRegistration[] registrations;
591        
592        /**
593         * Constructor
594         *
595         * @param registrations -
596         */
597        public workerRegistrationUpdated
598            (ServiceWorker.ServiceWorkerRegistration[] registrations)
599        {
600            super("ServiceWorker", "workerRegistrationUpdated", 1);
601            
602            // Exception-Check(s) to ensure that if any parameters which are not declared as
603            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
604            
605            if (registrations == null) THROWS.throwNPE("registrations");
606            
607            this.registrations  = registrations;
608        }
609        
610        /**
611         * JSON Object Constructor
612         * @param jo A Json-Object having data about an instance of {@code 'workerRegistrationUpdated'}.
613         */
614        public workerRegistrationUpdated (JsonObject jo)
615        {
616            super("ServiceWorker", "workerRegistrationUpdated", 1);
617        
618            this.registrations = (jo.getJsonArray("registrations") == null)
619                ? null
620                : RJArrIntoStream.objArr(jo.getJsonArray("registrations"), null, 0, ServiceWorker.ServiceWorkerRegistration.class).toArray(ServiceWorker.ServiceWorkerRegistration[]::new);
621        
622        }
623        
624        
625        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
626        public boolean equals(Object other)
627        {
628            if (this == other)                       return true;
629            if (other == null)                       return false;
630            if (other.getClass() != this.getClass()) return false;
631        
632            workerRegistrationUpdated o = (workerRegistrationUpdated) other;
633        
634            return
635                    Arrays.deepEquals(this.registrations, o.registrations);
636        }
637        
638        /** Generates a Hash-Code for {@code 'this'} instance */
639        public int hashCode()
640        {
641            return
642                    Arrays.deepHashCode(this.registrations);
643        }
644    }
645    
646    /** <CODE>[No Description Provided by Google]</CODE> */
647    public static class workerVersionUpdated
648        extends BrowserEvent
649        implements java.io.Serializable
650    {
651        /** For Object Serialization.  java.io.Serializable */
652        protected static final long serialVersionUID = 1;
653        
654        public boolean[] optionals()
655        { return new boolean[] { false, }; }
656        
657        /** <CODE>[No Description Provided by Google]</CODE> */
658        public final ServiceWorker.ServiceWorkerVersion[] versions;
659        
660        /**
661         * Constructor
662         *
663         * @param versions -
664         */
665        public workerVersionUpdated(ServiceWorker.ServiceWorkerVersion[] versions)
666        {
667            super("ServiceWorker", "workerVersionUpdated", 1);
668            
669            // Exception-Check(s) to ensure that if any parameters which are not declared as
670            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
671            
672            if (versions == null) THROWS.throwNPE("versions");
673            
674            this.versions  = versions;
675        }
676        
677        /**
678         * JSON Object Constructor
679         * @param jo A Json-Object having data about an instance of {@code 'workerVersionUpdated'}.
680         */
681        public workerVersionUpdated (JsonObject jo)
682        {
683            super("ServiceWorker", "workerVersionUpdated", 1);
684        
685            this.versions = (jo.getJsonArray("versions") == null)
686                ? null
687                : RJArrIntoStream.objArr(jo.getJsonArray("versions"), null, 0, ServiceWorker.ServiceWorkerVersion.class).toArray(ServiceWorker.ServiceWorkerVersion[]::new);
688        
689        }
690        
691        
692        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
693        public boolean equals(Object other)
694        {
695            if (this == other)                       return true;
696            if (other == null)                       return false;
697            if (other.getClass() != this.getClass()) return false;
698        
699            workerVersionUpdated o = (workerVersionUpdated) other;
700        
701            return
702                    Arrays.deepEquals(this.versions, o.versions);
703        }
704        
705        /** Generates a Hash-Code for {@code 'this'} instance */
706        public int hashCode()
707        {
708            return
709                    Arrays.deepHashCode(this.versions);
710        }
711    }
712    
713    
714    // Counter for keeping the WebSocket Request ID's distinct.
715    private static int counter = 1;
716    
717    /**
718     * <CODE>[No Description Provided by Google]</CODE>
719     * 
720     * @param origin -
721     * 
722     * @param registrationId -
723     * 
724     * @param data -
725     * 
726     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
727     * {@link Ret0}&gt;</CODE>
728     *
729     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
730     * browser receives the invocation-request.
731     *
732     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
733     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
734     * {@code >} to ensure the Browser Function has run to completion.
735     */
736    public static Script<String, JsonObject, Ret0> deliverPushMessage
737        (String origin, String registrationId, String data)
738    {
739        // Exception-Check(s) to ensure that if any parameters which are not declared as
740        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
741        
742        if (origin == null)         THROWS.throwNPE("origin");
743        if (registrationId == null) THROWS.throwNPE("registrationId");
744        if (data == null)           THROWS.throwNPE("data");
745        
746        final int       webSocketID = 36000000 + counter++;
747        final boolean[] optionals   = { false, false, false, };
748        
749        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
750        String requestJSON = WriteJSON.get(
751            parameterTypes.get("deliverPushMessage"),
752            parameterNames.get("deliverPushMessage"),
753            optionals, webSocketID,
754            "ServiceWorker.deliverPushMessage",
755            origin, registrationId, data
756        );
757        
758        // This Remote Command does not have a Return-Value.
759        return new Script<>
760            (webSocketID, requestJSON, VOID_RETURN.NoReturnValues);
761    }
762    
763    /**
764     * <CODE>[No Description Provided by Google]</CODE>
765     * 
766     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
767     * {@link Ret0}&gt;</CODE>
768     *
769     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
770     * browser receives the invocation-request.
771     *
772     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
773     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
774     * {@code >} to ensure the Browser Function has run to completion.
775     */
776    public static Script<String, JsonObject, Ret0> disable()
777    {
778        final int          webSocketID = 36001000 + counter++;
779        final boolean[]    optionals   = new boolean[0];
780        
781        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
782        String requestJSON = WriteJSON.get(
783            parameterTypes.get("disable"),
784            parameterNames.get("disable"),
785            optionals, webSocketID,
786            "ServiceWorker.disable"
787        );
788        
789        // This Remote Command does not have a Return-Value.
790        return new Script<>
791            (webSocketID, requestJSON, VOID_RETURN.NoReturnValues);
792    }
793    
794    /**
795     * <CODE>[No Description Provided by Google]</CODE>
796     * 
797     * @param origin -
798     * 
799     * @param registrationId -
800     * 
801     * @param tag -
802     * 
803     * @param lastChance -
804     * 
805     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
806     * {@link Ret0}&gt;</CODE>
807     *
808     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
809     * browser receives the invocation-request.
810     *
811     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
812     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
813     * {@code >} to ensure the Browser Function has run to completion.
814     */
815    public static Script<String, JsonObject, Ret0> dispatchSyncEvent
816        (String origin, String registrationId, String tag, boolean lastChance)
817    {
818        // Exception-Check(s) to ensure that if any parameters which are not declared as
819        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
820        
821        if (origin == null)         THROWS.throwNPE("origin");
822        if (registrationId == null) THROWS.throwNPE("registrationId");
823        if (tag == null)            THROWS.throwNPE("tag");
824        
825        final int       webSocketID = 36002000 + counter++;
826        final boolean[] optionals   = { false, false, false, false, };
827        
828        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
829        String requestJSON = WriteJSON.get(
830            parameterTypes.get("dispatchSyncEvent"),
831            parameterNames.get("dispatchSyncEvent"),
832            optionals, webSocketID,
833            "ServiceWorker.dispatchSyncEvent",
834            origin, registrationId, tag, lastChance
835        );
836        
837        // This Remote Command does not have a Return-Value.
838        return new Script<>
839            (webSocketID, requestJSON, VOID_RETURN.NoReturnValues);
840    }
841    
842    /**
843     * <CODE>[No Description Provided by Google]</CODE>
844     * 
845     * @param origin -
846     * 
847     * @param registrationId -
848     * 
849     * @param tag -
850     * 
851     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
852     * {@link Ret0}&gt;</CODE>
853     *
854     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
855     * browser receives the invocation-request.
856     *
857     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
858     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
859     * {@code >} to ensure the Browser Function has run to completion.
860     */
861    public static Script<String, JsonObject, Ret0> dispatchPeriodicSyncEvent
862        (String origin, String registrationId, String tag)
863    {
864        // Exception-Check(s) to ensure that if any parameters which are not declared as
865        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
866        
867        if (origin == null)         THROWS.throwNPE("origin");
868        if (registrationId == null) THROWS.throwNPE("registrationId");
869        if (tag == null)            THROWS.throwNPE("tag");
870        
871        final int       webSocketID = 36003000 + counter++;
872        final boolean[] optionals   = { false, false, false, };
873        
874        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
875        String requestJSON = WriteJSON.get(
876            parameterTypes.get("dispatchPeriodicSyncEvent"),
877            parameterNames.get("dispatchPeriodicSyncEvent"),
878            optionals, webSocketID,
879            "ServiceWorker.dispatchPeriodicSyncEvent",
880            origin, registrationId, tag
881        );
882        
883        // This Remote Command does not have a Return-Value.
884        return new Script<>
885            (webSocketID, requestJSON, VOID_RETURN.NoReturnValues);
886    }
887    
888    /**
889     * <CODE>[No Description Provided by Google]</CODE>
890     * 
891     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
892     * {@link Ret0}&gt;</CODE>
893     *
894     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
895     * browser receives the invocation-request.
896     *
897     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
898     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
899     * {@code >} to ensure the Browser Function has run to completion.
900     */
901    public static Script<String, JsonObject, Ret0> enable()
902    {
903        final int          webSocketID = 36004000 + counter++;
904        final boolean[]    optionals   = new boolean[0];
905        
906        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
907        String requestJSON = WriteJSON.get(
908            parameterTypes.get("enable"),
909            parameterNames.get("enable"),
910            optionals, webSocketID,
911            "ServiceWorker.enable"
912        );
913        
914        // This Remote Command does not have a Return-Value.
915        return new Script<>
916            (webSocketID, requestJSON, VOID_RETURN.NoReturnValues);
917    }
918    
919    /**
920     * <CODE>[No Description Provided by Google]</CODE>
921     * 
922     * @param versionId -
923     * 
924     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
925     * {@link Ret0}&gt;</CODE>
926     *
927     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
928     * browser receives the invocation-request.
929     *
930     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
931     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
932     * {@code >} to ensure the Browser Function has run to completion.
933     */
934    public static Script<String, JsonObject, Ret0> inspectWorker(String versionId)
935    {
936        // Exception-Check(s) to ensure that if any parameters which are not declared as
937        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
938        
939        if (versionId == null) THROWS.throwNPE("versionId");
940        
941        final int       webSocketID = 36005000 + counter++;
942        final boolean[] optionals   = { false, };
943        
944        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
945        String requestJSON = WriteJSON.get(
946            parameterTypes.get("inspectWorker"),
947            parameterNames.get("inspectWorker"),
948            optionals, webSocketID,
949            "ServiceWorker.inspectWorker",
950            versionId
951        );
952        
953        // This Remote Command does not have a Return-Value.
954        return new Script<>
955            (webSocketID, requestJSON, VOID_RETURN.NoReturnValues);
956    }
957    
958    /**
959     * <CODE>[No Description Provided by Google]</CODE>
960     * 
961     * @param forceUpdateOnPageLoad -
962     * 
963     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
964     * {@link Ret0}&gt;</CODE>
965     *
966     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
967     * browser receives the invocation-request.
968     *
969     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
970     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
971     * {@code >} to ensure the Browser Function has run to completion.
972     */
973    public static Script<String, JsonObject, Ret0> setForceUpdateOnPageLoad
974        (boolean forceUpdateOnPageLoad)
975    {
976        final int       webSocketID = 36006000 + counter++;
977        final boolean[] optionals   = { false, };
978        
979        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
980        String requestJSON = WriteJSON.get(
981            parameterTypes.get("setForceUpdateOnPageLoad"),
982            parameterNames.get("setForceUpdateOnPageLoad"),
983            optionals, webSocketID,
984            "ServiceWorker.setForceUpdateOnPageLoad",
985            forceUpdateOnPageLoad
986        );
987        
988        // This Remote Command does not have a Return-Value.
989        return new Script<>
990            (webSocketID, requestJSON, VOID_RETURN.NoReturnValues);
991    }
992    
993    /**
994     * <CODE>[No Description Provided by Google]</CODE>
995     * 
996     * @param scopeURL -
997     * 
998     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
999     * {@link Ret0}&gt;</CODE>
1000     *
1001     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
1002     * browser receives the invocation-request.
1003     *
1004     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
1005     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
1006     * {@code >} to ensure the Browser Function has run to completion.
1007     */
1008    public static Script<String, JsonObject, Ret0> skipWaiting(String scopeURL)
1009    {
1010        // Exception-Check(s) to ensure that if any parameters which are not declared as
1011        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
1012        
1013        if (scopeURL == null) THROWS.throwNPE("scopeURL");
1014        
1015        final int       webSocketID = 36007000 + counter++;
1016        final boolean[] optionals   = { false, };
1017        
1018        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
1019        String requestJSON = WriteJSON.get(
1020            parameterTypes.get("skipWaiting"),
1021            parameterNames.get("skipWaiting"),
1022            optionals, webSocketID,
1023            "ServiceWorker.skipWaiting",
1024            scopeURL
1025        );
1026        
1027        // This Remote Command does not have a Return-Value.
1028        return new Script<>
1029            (webSocketID, requestJSON, VOID_RETURN.NoReturnValues);
1030    }
1031    
1032    /**
1033     * <CODE>[No Description Provided by Google]</CODE>
1034     * 
1035     * @param scopeURL -
1036     * 
1037     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
1038     * {@link Ret0}&gt;</CODE>
1039     *
1040     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
1041     * browser receives the invocation-request.
1042     *
1043     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
1044     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
1045     * {@code >} to ensure the Browser Function has run to completion.
1046     */
1047    public static Script<String, JsonObject, Ret0> startWorker(String scopeURL)
1048    {
1049        // Exception-Check(s) to ensure that if any parameters which are not declared as
1050        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
1051        
1052        if (scopeURL == null) THROWS.throwNPE("scopeURL");
1053        
1054        final int       webSocketID = 36008000 + counter++;
1055        final boolean[] optionals   = { false, };
1056        
1057        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
1058        String requestJSON = WriteJSON.get(
1059            parameterTypes.get("startWorker"),
1060            parameterNames.get("startWorker"),
1061            optionals, webSocketID,
1062            "ServiceWorker.startWorker",
1063            scopeURL
1064        );
1065        
1066        // This Remote Command does not have a Return-Value.
1067        return new Script<>
1068            (webSocketID, requestJSON, VOID_RETURN.NoReturnValues);
1069    }
1070    
1071    /**
1072     * <CODE>[No Description Provided by Google]</CODE>
1073     * 
1074     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
1075     * {@link Ret0}&gt;</CODE>
1076     *
1077     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
1078     * browser receives the invocation-request.
1079     *
1080     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
1081     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
1082     * {@code >} to ensure the Browser Function has run to completion.
1083     */
1084    public static Script<String, JsonObject, Ret0> stopAllWorkers()
1085    {
1086        final int          webSocketID = 36009000 + counter++;
1087        final boolean[]    optionals   = new boolean[0];
1088        
1089        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
1090        String requestJSON = WriteJSON.get(
1091            parameterTypes.get("stopAllWorkers"),
1092            parameterNames.get("stopAllWorkers"),
1093            optionals, webSocketID,
1094            "ServiceWorker.stopAllWorkers"
1095        );
1096        
1097        // This Remote Command does not have a Return-Value.
1098        return new Script<>
1099            (webSocketID, requestJSON, VOID_RETURN.NoReturnValues);
1100    }
1101    
1102    /**
1103     * <CODE>[No Description Provided by Google]</CODE>
1104     * 
1105     * @param versionId -
1106     * 
1107     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
1108     * {@link Ret0}&gt;</CODE>
1109     *
1110     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
1111     * browser receives the invocation-request.
1112     *
1113     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
1114     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
1115     * {@code >} to ensure the Browser Function has run to completion.
1116     */
1117    public static Script<String, JsonObject, Ret0> stopWorker(String versionId)
1118    {
1119        // Exception-Check(s) to ensure that if any parameters which are not declared as
1120        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
1121        
1122        if (versionId == null) THROWS.throwNPE("versionId");
1123        
1124        final int       webSocketID = 36010000 + counter++;
1125        final boolean[] optionals   = { false, };
1126        
1127        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
1128        String requestJSON = WriteJSON.get(
1129            parameterTypes.get("stopWorker"),
1130            parameterNames.get("stopWorker"),
1131            optionals, webSocketID,
1132            "ServiceWorker.stopWorker",
1133            versionId
1134        );
1135        
1136        // This Remote Command does not have a Return-Value.
1137        return new Script<>
1138            (webSocketID, requestJSON, VOID_RETURN.NoReturnValues);
1139    }
1140    
1141    /**
1142     * <CODE>[No Description Provided by Google]</CODE>
1143     * 
1144     * @param scopeURL -
1145     * 
1146     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
1147     * {@link Ret0}&gt;</CODE>
1148     *
1149     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
1150     * browser receives the invocation-request.
1151     *
1152     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
1153     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
1154     * {@code >} to ensure the Browser Function has run to completion.
1155     */
1156    public static Script<String, JsonObject, Ret0> unregister(String scopeURL)
1157    {
1158        // Exception-Check(s) to ensure that if any parameters which are not declared as
1159        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
1160        
1161        if (scopeURL == null) THROWS.throwNPE("scopeURL");
1162        
1163        final int       webSocketID = 36011000 + counter++;
1164        final boolean[] optionals   = { false, };
1165        
1166        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
1167        String requestJSON = WriteJSON.get(
1168            parameterTypes.get("unregister"),
1169            parameterNames.get("unregister"),
1170            optionals, webSocketID,
1171            "ServiceWorker.unregister",
1172            scopeURL
1173        );
1174        
1175        // This Remote Command does not have a Return-Value.
1176        return new Script<>
1177            (webSocketID, requestJSON, VOID_RETURN.NoReturnValues);
1178    }
1179    
1180    /**
1181     * <CODE>[No Description Provided by Google]</CODE>
1182     * 
1183     * @param scopeURL -
1184     * 
1185     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
1186     * {@link Ret0}&gt;</CODE>
1187     *
1188     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
1189     * browser receives the invocation-request.
1190     *
1191     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
1192     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
1193     * {@code >} to ensure the Browser Function has run to completion.
1194     */
1195    public static Script<String, JsonObject, Ret0> updateRegistration(String scopeURL)
1196    {
1197        // Exception-Check(s) to ensure that if any parameters which are not declared as
1198        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
1199        
1200        if (scopeURL == null) THROWS.throwNPE("scopeURL");
1201        
1202        final int       webSocketID = 36012000 + counter++;
1203        final boolean[] optionals   = { false, };
1204        
1205        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
1206        String requestJSON = WriteJSON.get(
1207            parameterTypes.get("updateRegistration"),
1208            parameterNames.get("updateRegistration"),
1209            optionals, webSocketID,
1210            "ServiceWorker.updateRegistration",
1211            scopeURL
1212        );
1213        
1214        // This Remote Command does not have a Return-Value.
1215        return new Script<>
1216            (webSocketID, requestJSON, VOID_RETURN.NoReturnValues);
1217    }
1218    
1219}