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>Query and modify DOM storage.</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 DOMStorage 030{ 031 // ******************************************************************************************** 032 // ******************************************************************************************** 033 // Class Header Stuff 034 // ******************************************************************************************** 035 // ******************************************************************************************** 036 037 038 // No Pubic Constructors 039 private DOMStorage () { } 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 : DOMStorage.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>(1); 078 parameterNames.put("clear", v); 079 Collections.addAll(v, new String[] 080 { "storageId", }); 081 082 parameterNames.put("disable", EMPTY_VEC_STR); 083 084 parameterNames.put("enable", EMPTY_VEC_STR); 085 086 v = new Vector<String>(1); 087 parameterNames.put("getDOMStorageItems", v); 088 Collections.addAll(v, new String[] 089 { "storageId", }); 090 091 v = new Vector<String>(2); 092 parameterNames.put("removeDOMStorageItem", v); 093 Collections.addAll(v, new String[] 094 { "storageId", "key", }); 095 096 v = new Vector<String>(3); 097 parameterNames.put("setDOMStorageItem", v); 098 Collections.addAll(v, new String[] 099 { "storageId", "key", "value", }); 100 } 101 102 103 // ******************************************************************************************** 104 // ******************************************************************************************** 105 // Types - Static Inner Classes 106 // ******************************************************************************************** 107 // ******************************************************************************************** 108 109 // public static class Item => String[] 110 111 /** DOM Storage identifier. */ 112 public static class StorageId 113 extends BaseType 114 implements java.io.Serializable 115 { 116 /** For Object Serialization. java.io.Serializable */ 117 protected static final long serialVersionUID = 1; 118 119 public boolean[] optionals() 120 { return new boolean[] { false, false, }; } 121 122 /** Security origin for the storage. */ 123 public final String securityOrigin; 124 125 /** Whether the storage is local storage (not session storage). */ 126 public final boolean isLocalStorage; 127 128 /** 129 * Constructor 130 * 131 * @param securityOrigin Security origin for the storage. 132 * 133 * @param isLocalStorage Whether the storage is local storage (not session storage). 134 */ 135 public StorageId(String securityOrigin, boolean isLocalStorage) 136 { 137 // Exception-Check(s) to ensure that if any parameters which are not declared as 138 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 139 140 if (securityOrigin == null) THROWS.throwNPE("securityOrigin"); 141 142 this.securityOrigin = securityOrigin; 143 this.isLocalStorage = isLocalStorage; 144 } 145 146 /** 147 * JSON Object Constructor 148 * @param jo A Json-Object having data about an instance of {@code 'StorageId'}. 149 */ 150 public StorageId (JsonObject jo) 151 { 152 this.securityOrigin = ReadJSON.getString(jo, "securityOrigin", false, true); 153 this.isLocalStorage = ReadPrimJSON.getBoolean(jo, "isLocalStorage"); 154 } 155 156 157 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 158 public boolean equals(Object other) 159 { 160 if (this == other) return true; 161 if (other == null) return false; 162 if (other.getClass() != this.getClass()) return false; 163 164 StorageId o = (StorageId) other; 165 166 return 167 Objects.equals(this.securityOrigin, o.securityOrigin) 168 && (this.isLocalStorage == o.isLocalStorage); 169 } 170 171 /** Generates a Hash-Code for {@code 'this'} instance */ 172 public int hashCode() 173 { 174 return 175 Objects.hashCode(this.securityOrigin) 176 + (this.isLocalStorage ? 1 : 0); 177 } 178 } 179 180 /** <CODE>[No Description Provided by Google]</CODE> */ 181 public static class domStorageItemAdded 182 extends BrowserEvent 183 implements java.io.Serializable 184 { 185 /** For Object Serialization. java.io.Serializable */ 186 protected static final long serialVersionUID = 1; 187 188 public boolean[] optionals() 189 { return new boolean[] { false, false, false, }; } 190 191 /** <CODE>[No Description Provided by Google]</CODE> */ 192 public final DOMStorage.StorageId storageId; 193 194 /** <CODE>[No Description Provided by Google]</CODE> */ 195 public final String key; 196 197 /** <CODE>[No Description Provided by Google]</CODE> */ 198 public final String newValue; 199 200 /** 201 * Constructor 202 * 203 * @param storageId - 204 * 205 * @param key - 206 * 207 * @param newValue - 208 */ 209 public domStorageItemAdded(DOMStorage.StorageId storageId, String key, String newValue) 210 { 211 super("DOMStorage", "domStorageItemAdded", 3); 212 213 // Exception-Check(s) to ensure that if any parameters which are not declared as 214 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 215 216 if (storageId == null) THROWS.throwNPE("storageId"); 217 if (key == null) THROWS.throwNPE("key"); 218 if (newValue == null) THROWS.throwNPE("newValue"); 219 220 this.storageId = storageId; 221 this.key = key; 222 this.newValue = newValue; 223 } 224 225 /** 226 * JSON Object Constructor 227 * @param jo A Json-Object having data about an instance of {@code 'domStorageItemAdded'}. 228 */ 229 public domStorageItemAdded (JsonObject jo) 230 { 231 super("DOMStorage", "domStorageItemAdded", 3); 232 233 this.storageId = ReadJSON.getObject(jo, "storageId", DOMStorage.StorageId.class, false, true); 234 this.key = ReadJSON.getString(jo, "key", false, true); 235 this.newValue = ReadJSON.getString(jo, "newValue", false, true); 236 } 237 238 239 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 240 public boolean equals(Object other) 241 { 242 if (this == other) return true; 243 if (other == null) return false; 244 if (other.getClass() != this.getClass()) return false; 245 246 domStorageItemAdded o = (domStorageItemAdded) other; 247 248 return 249 Objects.equals(this.storageId, o.storageId) 250 && Objects.equals(this.key, o.key) 251 && Objects.equals(this.newValue, o.newValue); 252 } 253 254 /** Generates a Hash-Code for {@code 'this'} instance */ 255 public int hashCode() 256 { 257 return 258 this.storageId.hashCode() 259 + Objects.hashCode(this.key) 260 + Objects.hashCode(this.newValue); 261 } 262 } 263 264 /** <CODE>[No Description Provided by Google]</CODE> */ 265 public static class domStorageItemRemoved 266 extends BrowserEvent 267 implements java.io.Serializable 268 { 269 /** For Object Serialization. java.io.Serializable */ 270 protected static final long serialVersionUID = 1; 271 272 public boolean[] optionals() 273 { return new boolean[] { false, false, }; } 274 275 /** <CODE>[No Description Provided by Google]</CODE> */ 276 public final DOMStorage.StorageId storageId; 277 278 /** <CODE>[No Description Provided by Google]</CODE> */ 279 public final String key; 280 281 /** 282 * Constructor 283 * 284 * @param storageId - 285 * 286 * @param key - 287 */ 288 public domStorageItemRemoved(DOMStorage.StorageId storageId, String key) 289 { 290 super("DOMStorage", "domStorageItemRemoved", 2); 291 292 // Exception-Check(s) to ensure that if any parameters which are not declared as 293 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 294 295 if (storageId == null) THROWS.throwNPE("storageId"); 296 if (key == null) THROWS.throwNPE("key"); 297 298 this.storageId = storageId; 299 this.key = key; 300 } 301 302 /** 303 * JSON Object Constructor 304 * @param jo A Json-Object having data about an instance of {@code 'domStorageItemRemoved'}. 305 */ 306 public domStorageItemRemoved (JsonObject jo) 307 { 308 super("DOMStorage", "domStorageItemRemoved", 2); 309 310 this.storageId = ReadJSON.getObject(jo, "storageId", DOMStorage.StorageId.class, false, true); 311 this.key = ReadJSON.getString(jo, "key", false, true); 312 } 313 314 315 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 316 public boolean equals(Object other) 317 { 318 if (this == other) return true; 319 if (other == null) return false; 320 if (other.getClass() != this.getClass()) return false; 321 322 domStorageItemRemoved o = (domStorageItemRemoved) other; 323 324 return 325 Objects.equals(this.storageId, o.storageId) 326 && Objects.equals(this.key, o.key); 327 } 328 329 /** Generates a Hash-Code for {@code 'this'} instance */ 330 public int hashCode() 331 { 332 return 333 this.storageId.hashCode() 334 + Objects.hashCode(this.key); 335 } 336 } 337 338 /** <CODE>[No Description Provided by Google]</CODE> */ 339 public static class domStorageItemUpdated 340 extends BrowserEvent 341 implements java.io.Serializable 342 { 343 /** For Object Serialization. java.io.Serializable */ 344 protected static final long serialVersionUID = 1; 345 346 public boolean[] optionals() 347 { return new boolean[] { false, false, false, false, }; } 348 349 /** <CODE>[No Description Provided by Google]</CODE> */ 350 public final DOMStorage.StorageId storageId; 351 352 /** <CODE>[No Description Provided by Google]</CODE> */ 353 public final String key; 354 355 /** <CODE>[No Description Provided by Google]</CODE> */ 356 public final String oldValue; 357 358 /** <CODE>[No Description Provided by Google]</CODE> */ 359 public final String newValue; 360 361 /** 362 * Constructor 363 * 364 * @param storageId - 365 * 366 * @param key - 367 * 368 * @param oldValue - 369 * 370 * @param newValue - 371 */ 372 public domStorageItemUpdated 373 (DOMStorage.StorageId storageId, String key, String oldValue, String newValue) 374 { 375 super("DOMStorage", "domStorageItemUpdated", 4); 376 377 // Exception-Check(s) to ensure that if any parameters which are not declared as 378 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 379 380 if (storageId == null) THROWS.throwNPE("storageId"); 381 if (key == null) THROWS.throwNPE("key"); 382 if (oldValue == null) THROWS.throwNPE("oldValue"); 383 if (newValue == null) THROWS.throwNPE("newValue"); 384 385 this.storageId = storageId; 386 this.key = key; 387 this.oldValue = oldValue; 388 this.newValue = newValue; 389 } 390 391 /** 392 * JSON Object Constructor 393 * @param jo A Json-Object having data about an instance of {@code 'domStorageItemUpdated'}. 394 */ 395 public domStorageItemUpdated (JsonObject jo) 396 { 397 super("DOMStorage", "domStorageItemUpdated", 4); 398 399 this.storageId = ReadJSON.getObject(jo, "storageId", DOMStorage.StorageId.class, false, true); 400 this.key = ReadJSON.getString(jo, "key", false, true); 401 this.oldValue = ReadJSON.getString(jo, "oldValue", false, true); 402 this.newValue = ReadJSON.getString(jo, "newValue", false, true); 403 } 404 405 406 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 407 public boolean equals(Object other) 408 { 409 if (this == other) return true; 410 if (other == null) return false; 411 if (other.getClass() != this.getClass()) return false; 412 413 domStorageItemUpdated o = (domStorageItemUpdated) other; 414 415 return 416 Objects.equals(this.storageId, o.storageId) 417 && Objects.equals(this.key, o.key) 418 && Objects.equals(this.oldValue, o.oldValue) 419 && Objects.equals(this.newValue, o.newValue); 420 } 421 422 /** Generates a Hash-Code for {@code 'this'} instance */ 423 public int hashCode() 424 { 425 return 426 this.storageId.hashCode() 427 + Objects.hashCode(this.key) 428 + Objects.hashCode(this.oldValue) 429 + Objects.hashCode(this.newValue); 430 } 431 } 432 433 /** <CODE>[No Description Provided by Google]</CODE> */ 434 public static class domStorageItemsCleared 435 extends BrowserEvent 436 implements java.io.Serializable 437 { 438 /** For Object Serialization. java.io.Serializable */ 439 protected static final long serialVersionUID = 1; 440 441 public boolean[] optionals() 442 { return new boolean[] { false, }; } 443 444 /** <CODE>[No Description Provided by Google]</CODE> */ 445 public final DOMStorage.StorageId storageId; 446 447 /** 448 * Constructor 449 * 450 * @param storageId - 451 */ 452 public domStorageItemsCleared(DOMStorage.StorageId storageId) 453 { 454 super("DOMStorage", "domStorageItemsCleared", 1); 455 456 // Exception-Check(s) to ensure that if any parameters which are not declared as 457 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 458 459 if (storageId == null) THROWS.throwNPE("storageId"); 460 461 this.storageId = storageId; 462 } 463 464 /** 465 * JSON Object Constructor 466 * @param jo A Json-Object having data about an instance of {@code 'domStorageItemsCleared'}. 467 */ 468 public domStorageItemsCleared (JsonObject jo) 469 { 470 super("DOMStorage", "domStorageItemsCleared", 1); 471 472 this.storageId = ReadJSON.getObject(jo, "storageId", DOMStorage.StorageId.class, false, true); 473 } 474 475 476 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 477 public boolean equals(Object other) 478 { 479 if (this == other) return true; 480 if (other == null) return false; 481 if (other.getClass() != this.getClass()) return false; 482 483 domStorageItemsCleared o = (domStorageItemsCleared) other; 484 485 return 486 Objects.equals(this.storageId, o.storageId); 487 } 488 489 /** Generates a Hash-Code for {@code 'this'} instance */ 490 public int hashCode() 491 { 492 return 493 this.storageId.hashCode(); 494 } 495 } 496 497 498 // Counter for keeping the WebSocket Request ID's distinct. 499 private static int counter = 1; 500 501 /** 502 * <CODE>[No Description Provided by Google]</CODE> 503 * 504 * @param storageId - 505 * 506 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 507 * {@link Ret0}></CODE> 508 * 509 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 510 * browser receives the invocation-request. 511 * 512 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 513 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 514 * {@code >} to ensure the Browser Function has run to completion. 515 */ 516 public static Script<String, JsonObject, Ret0> clear(DOMStorage.StorageId storageId) 517 { 518 // Exception-Check(s) to ensure that if any parameters which are not declared as 519 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 520 521 if (storageId == null) THROWS.throwNPE("storageId"); 522 523 final int webSocketID = 18000000 + counter++; 524 final boolean[] optionals = { false, }; 525 526 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 527 String requestJSON = WriteJSON.get( 528 parameterTypes.get("clear"), 529 parameterNames.get("clear"), 530 optionals, webSocketID, 531 "DOMStorage.clear", 532 storageId 533 ); 534 535 // This Remote Command does not have a Return-Value. 536 return new Script<> 537 (webSocketID, requestJSON, VOID_RETURN.NoReturnValues); 538 } 539 540 /** 541 * Disables storage tracking, prevents storage events from being sent to the client. 542 * 543 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 544 * {@link Ret0}></CODE> 545 * 546 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 547 * browser receives the invocation-request. 548 * 549 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 550 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 551 * {@code >} to ensure the Browser Function has run to completion. 552 */ 553 public static Script<String, JsonObject, Ret0> disable() 554 { 555 final int webSocketID = 18001000 + counter++; 556 final boolean[] optionals = new boolean[0]; 557 558 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 559 String requestJSON = WriteJSON.get( 560 parameterTypes.get("disable"), 561 parameterNames.get("disable"), 562 optionals, webSocketID, 563 "DOMStorage.disable" 564 ); 565 566 // This Remote Command does not have a Return-Value. 567 return new Script<> 568 (webSocketID, requestJSON, VOID_RETURN.NoReturnValues); 569 } 570 571 /** 572 * Enables storage tracking, storage events will now be delivered to the client. 573 * 574 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 575 * {@link Ret0}></CODE> 576 * 577 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 578 * browser receives the invocation-request. 579 * 580 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 581 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 582 * {@code >} to ensure the Browser Function has run to completion. 583 */ 584 public static Script<String, JsonObject, Ret0> enable() 585 { 586 final int webSocketID = 18002000 + counter++; 587 final boolean[] optionals = new boolean[0]; 588 589 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 590 String requestJSON = WriteJSON.get( 591 parameterTypes.get("enable"), 592 parameterNames.get("enable"), 593 optionals, webSocketID, 594 "DOMStorage.enable" 595 ); 596 597 // This Remote Command does not have a Return-Value. 598 return new Script<> 599 (webSocketID, requestJSON, VOID_RETURN.NoReturnValues); 600 } 601 602 /** 603 * <CODE>[No Description Provided by Google]</CODE> 604 * 605 * @param storageId - 606 * 607 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 608 * String[][]></CODE> 609 * 610 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 611 * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE><JsonObject, 612 * String[][]></CODE> will be returned. 613 * 614 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 615 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 616 * may be retrieved.</I> 617 * 618 * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B> 619 * <BR /><BR /><UL CLASS=JDUL> 620 * <LI><CODE>String[][] (<B>entries</B></CODE>) 621 * <BR />- 622 * </LI> 623 * </UL> */ 624 public static Script<String, JsonObject, String[][]> getDOMStorageItems 625 (DOMStorage.StorageId storageId) 626 { 627 // Exception-Check(s) to ensure that if any parameters which are not declared as 628 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 629 630 if (storageId == null) THROWS.throwNPE("storageId"); 631 632 final int webSocketID = 18003000 + counter++; 633 final boolean[] optionals = { false, }; 634 635 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 636 String requestJSON = WriteJSON.get( 637 parameterTypes.get("getDOMStorageItems"), 638 parameterNames.get("getDOMStorageItems"), 639 optionals, webSocketID, 640 "DOMStorage.getDOMStorageItems", 641 storageId 642 ); 643 644 // 'JSON Binding' ... Converts Browser Response-JSON to 'String[][]' 645 Function<JsonObject, String[][]> responseProcessor = (JsonObject jo) -> 646 (jo.getJsonArray("entries") == null) 647 ? null 648 : RJArrDimN.strArr(jo.getJsonArray("entries"), null, 0, String[][].class); 649 650 return new Script<>(webSocketID, requestJSON, responseProcessor); 651 } 652 653 /** 654 * <CODE>[No Description Provided by Google]</CODE> 655 * 656 * @param storageId - 657 * 658 * @param key - 659 * 660 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 661 * {@link Ret0}></CODE> 662 * 663 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 664 * browser receives the invocation-request. 665 * 666 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 667 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 668 * {@code >} to ensure the Browser Function has run to completion. 669 */ 670 public static Script<String, JsonObject, Ret0> removeDOMStorageItem 671 (DOMStorage.StorageId storageId, String key) 672 { 673 // Exception-Check(s) to ensure that if any parameters which are not declared as 674 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 675 676 if (storageId == null) THROWS.throwNPE("storageId"); 677 if (key == null) THROWS.throwNPE("key"); 678 679 final int webSocketID = 18004000 + counter++; 680 final boolean[] optionals = { false, false, }; 681 682 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 683 String requestJSON = WriteJSON.get( 684 parameterTypes.get("removeDOMStorageItem"), 685 parameterNames.get("removeDOMStorageItem"), 686 optionals, webSocketID, 687 "DOMStorage.removeDOMStorageItem", 688 storageId, key 689 ); 690 691 // This Remote Command does not have a Return-Value. 692 return new Script<> 693 (webSocketID, requestJSON, VOID_RETURN.NoReturnValues); 694 } 695 696 /** 697 * <CODE>[No Description Provided by Google]</CODE> 698 * 699 * @param storageId - 700 * 701 * @param key - 702 * 703 * @param value - 704 * 705 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 706 * {@link Ret0}></CODE> 707 * 708 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 709 * browser receives the invocation-request. 710 * 711 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 712 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 713 * {@code >} to ensure the Browser Function has run to completion. 714 */ 715 public static Script<String, JsonObject, Ret0> setDOMStorageItem 716 (DOMStorage.StorageId storageId, String key, String value) 717 { 718 // Exception-Check(s) to ensure that if any parameters which are not declared as 719 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 720 721 if (storageId == null) THROWS.throwNPE("storageId"); 722 if (key == null) THROWS.throwNPE("key"); 723 if (value == null) THROWS.throwNPE("value"); 724 725 final int webSocketID = 18005000 + counter++; 726 final boolean[] optionals = { false, false, false, }; 727 728 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 729 String requestJSON = WriteJSON.get( 730 parameterTypes.get("setDOMStorageItem"), 731 parameterNames.get("setDOMStorageItem"), 732 optionals, webSocketID, 733 "DOMStorage.setDOMStorageItem", 734 storageId, key, value 735 ); 736 737 // This Remote Command does not have a Return-Value. 738 return new Script<> 739 (webSocketID, requestJSON, VOID_RETURN.NoReturnValues); 740 } 741 742}