001package Torello.Browser.JavaScriptAPI; 002 003// *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 004// Java-HTML Imports 005// *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 006 007import Torello.Browser.*; 008import Torello.Browser.helper.*; 009import Torello.Browser.BrowserAPI.*; 010import Torello.JSON.*; 011 012import Torello.Java.ReadOnly.ReadOnlyList; 013import Torello.Java.ReadOnly.ReadOnlyArrayList; 014 015import Torello.JavaDoc.Annotations.StaticFunctional; 016import Torello.JavaDoc.Annotations.JDHeaderBackgroundImg; 017 018import Torello.Browser.JavaScriptAPI.NestedHelpers.Commands.Schema$$Commands; 019 020 021// *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 022// JDK Imports 023// *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 024 025import javax.json.JsonObject; 026import javax.json.JsonValue; 027 028/** 029 * <SPAN CLASS=COPIEDJDK><B>This domain is deprecated.</B></SPAN> 030 * <EMBED CLASS='external-html' DATA-FILE-ID=CDP.CODE_GEN_NOTE> 031 */ 032@StaticFunctional@JDHeaderBackgroundImg(EmbedTagFileID="CDP.WOOD_PLANK_NOTE") 033public class Schema 034{ 035 // No Pubic Constructors 036 private Schema() { } 037 038 039 040 // ******************************************************************************************** 041 // ******************************************************************************************** 042 // Basic Types 043 // ******************************************************************************************** 044 // ******************************************************************************************** 045 046 047 /** 048 * Description of the protocol domain. 049 * 050 * <EMBED CLASS=globalDefs DATA-DOMAIN=Schema DATA-API=JavaScriptAPI> 051 */ 052 @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_TYPE_JDHBI") 053 public static class Domain 054 extends BaseType<Domain> 055 implements java.io.Serializable 056 { 057 /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */ 058 protected static final long serialVersionUID = 1; 059 060 private static final NestedHelper<Schema.Domain> singleton = 061 Torello.Browser.JavaScriptAPI.NestedHelpers.Types. 062 Schema$$Domain$$.singleton; 063 064 /** Domain name. */ 065 public final String name; 066 067 /** Domain version. */ 068 public final String version; 069 070 /** Constructor. Please review this class' fields for documentation. */ 071 public Domain(ReadOnlyList<Boolean> isPresent, String name, String version) 072 { 073 super(singleton, Domains.Schema, "Domain", 2); 074 075 this.name = name; 076 this.version = version; 077 078 this.isPresent = (isPresent == null) 079 ? singleton.generateIsPresentList(this) 080 : THROWS.check(isPresent, 2, "Schema.Domain"); 081 } 082 083 /** Creates an instance of this class from a {@link JsonObject}.*/ 084 public static Domain fromJSON(JsonObject jo) 085 { return singleton.fromJSON(jo); } 086 087 /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/ 088 public static NestedDescriptor<Domain> descriptor() 089 { return singleton.descriptor(); } 090 } 091 092 093 094 095 // ******************************************************************************************** 096 // ******************************************************************************************** 097 // Commands 098 // ******************************************************************************************** 099 // ******************************************************************************************** 100 101 102 /** 103 * Returns supported domains. 104 * 105 * @return An instance of <CODE>{@link Script}<{@link Schema.Domain}[]></CODE> 106 * 107 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 108 * {@link Script#exec(WebSocketSender) Script.exec}, and afterwards, a {@link Promise} 109 * <CODE><{@link Schema.Domain}[]></CODE> will be returned 110 * 111 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 112 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 113 * be retrieved.</I> 114 * 115 * <BR /><BR /><DIV CLASS=JDHint> 116 * This Browser Function's {@code Promise} returns: 117 * <CODE>{@link Schema.Domain}[] (<B>domains</B>)</CODE> 118 * <BR /> 119 * List of supported domains. 120 * </DIV> 121 */ 122 public static Script<Schema.Domain[]> getDomains() 123 { 124 // Ultra-Simple Request JSON - Because this method has no parameters 125 final String requestJSON = "{\"method\":\"Schema.getDomains\"}"; 126 127 return new Script<>( 128 Domains.Schema, "getDomains", requestJSON, 129 Schema$$Commands::getDomains, 130 Schema.Domain[].class 131 ); 132 } 133 134 135}