Package Torello.Browser.JsonAST
Class Domain
- java.lang.Object
-
- Torello.Browser.JsonAST.Domain
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<Domain>
public class Domain extends java.lang.Object implements java.io.Serializable, java.lang.Comparable<Domain>
The class class comprises the intended public facing API for theJsonAST-Package. It is easy to load the Abstract Syntax Tree's from disk by invoking thedeserializeFromJAR()method inside of classSERIALIZED_AST. Remember that the entire packageTorello.Browser.JsonASTis used primarily by a proprietary, and yet unreleased code generator, and is only made public for informational & reference purposes.
Loading the the serialized trees from the'.jar'file, perhaps, may elucidate some of Google's Browser CDP API. The nodes themselves have quite a bit of read only data available.Maintains all relevant data and references for a single CDP Domain; you may view the complete list of domains by reveiwing the top level classes in either the Torello.Browser.BrowserAPI and Torello.Browser.JavaScriptAPI packages.
Just as a reminder, inside of a Web Browser, a "domain" appears to be (and this is not exactly perspicacious from the JSON Files) extremely similar to what Java Programmers would call a "Java Package". CDP / Google-Chome"domains"essentially group together methods, classes & event classes which are related. This is essentially what a Java Package is too.
The following two tree diagrams, with explanation, are repeated verbatim across all eight AST Node Classes.Object Inheritance for AST Nodes, and RunTime Tree Organization
The Objects which are generated by the JSON Parser are converted into AST Node Object-Instances, all of which are listed here, below. An in depth study of the CDP Specification, a programmer must realize that there are actually three (possibly four) different trees functioning simultaneously. The Classes themselves have their own "Inheritance Tree." Then, additionally, by its very nature, the original JSON Spec Files are organized in a Tree Structure (as is all JSON, you may view these trees here:Browser API JSONandJavaScript API JSON
Finally, and most importantly, at RunTime as Objects Instances, themselves, are created by the Parser; they are saved into the "Abstract Syntax Tree" (AST for short). These instances are placed into this AST, by saving them intoReadOnlyList'sfrom theReadOnly Collections Framework.
Class Inheritance Tree:The diagram below shows the static class hierarchy: how the core JsonAST classes inherit from one another at the type level.
Runtime Object Instance Tree:In contrast, this diagram shows the dynamic structure at runtime: how reified instances of those same classes are organized into an AST, with parent–child container relationships.
API└─Domain├─TypeNode│ └─PPR➜ [P]roperties ➜ Generate to Java Class Fields ├─CommandNode│ ├─PPR➜ [P]arameters ➜ Generate to Java Method Parameters │ └─PPR➜ [R]eturn-Values ➜ Generate to Java Method Return Values └─EventNode└─PPR➜ [P]arameters ➜ Generate to Java "Event Class" Fields
The following sixJsonObjectproperties are mapped to the followingEntitysubclasses:Json Object Type AST Node Java Conversion "Target" Type TypeNodeConverted into Java Inner Classes / Nested Types of the Primary Domain Java-Classes Command CommandNodeConverted into Java Methods within the Primary Domain Java-Classes Event EventNodeAlso Converted into Inner Classes / Nested Types of the Primary Domain Java-Classes Property PPRConverted into typical Java Fields within the Inner Types / Nested Classes.
(See note †† below.)Parameter PPRFor Commands, these are Converted by the Code Generator into Method Parameters. For Events, these are actually also just converted into Fields of the Nested Event Class too.
(See note †† below.)Return Value PPRThese are converted (for Commands), into Return-Values for the Methods. Using the "Multi-Return Tuples" RetNdefined in theJava.Additionalpackage, it is possible (and quite common, actually) to return multiple values from a single method invocation.
(See note †† below.)
†† UnlikeTCE, Properties, Parameters, and Return-Values do not have their own dedicated AST nodes, because their content is always identical to that in base classPPR.- See Also:
- Serialized Form
Hi-Lited Source-Code:- View Here: Torello/Browser/JsonAST/Domain.java
- Open New Browser-Tab: Torello/Browser/JsonAST/Domain.java
File Size: 10,736 Bytes Line Count: 252 '\n' Characters Found
-
-
Field Summary
Serializable ID Modifier and Type Field Description protected static longserialVersionUIDCore Identity: Fundamental Details of this Domain Modifier and Type Field Description StringdescriptionHuman-readable description extracted from the spec; may be empty if not provided.intidUnique process-local identifier for this domain instance, assigned internally byIDManager.nextID()StringnameDomain name taken from the spec’s "domain" property (e.g., 'Network', 'Runtime', etc.).APIownerAPIOwning API this domain belongs to (Browser API or JavaScript API).ReadOnlyList<PropName>propNamesComplete list of top-level JSON property names present within the definition for this domain'sJsonObject.Lifecycle Flags: Markers / Flags Ascribed to this Domain by the Google API Definition File Modifier and Type Field Description booleandeprecatedTRUEif the spec marks this domain as deprecated.booleanexperimentalTRUEif the spec marks this domain as experimental.TCE List: The Types, Commands & Events that make up this Domain Modifier and Type Field Description ReadOnlyList<CommandNode>commandsAll type definitions declared under this domain, parsed and extracted intoCommandNodeinstances.ReadOnlyList<EventNode>eventsAll type definitions declared under this domain, parsed and extracted intoEventNodeinstances.ReadOnlyList<TypeNode>typesAll type definitions declared under this domain, parsed and extracted intoTypeNodeinstances.Unused, but Parsed: List of Domains upon which this Domain Depends Modifier and Type Field Description ReadOnlyList<String>depAsStrsRaw "dependencies" array preserved from the spec asString's.
-
Method Summary
Unused, but Parsed: Instance Getter for Private, non-Final, Linked Dependancies List Modifier and Type Method Description ReadOnlyList<Domain>getDependencies()The list of dependent domains.Methods: interface java.lang.Comparable Modifier and Type Method Description intcompareTo(Domain other)Checksnamefields, using the standardString.compareToto produce a comparison value.Methods: class java.lang.Object Modifier and Type Method Description booleanequals(Object other)Checksthis.idagainstother.idfor equality.inthashCode()Utilizesthis.idas a hash; it is a unique value across the AST Tree.StringtoString()Generates a fullStringrepresentation ofthisinstance.
-
-
-
Field Detail
-
serialVersionUID
protected static final long serialVersionUID
- See Also:
- Constant Field Values
- Code:
- Exact Field Declaration Expression:
protected static final long serialVersionUID = 1;
-
id
public final int id
Unique process-local identifier for this domain instance, assigned internally byIDManager.nextID()- Code:
- Exact Field Declaration Expression:
public final int id = IDManager.nextID();
-
name
public final java.lang.String name
Domain name taken from the spec’s "domain" property (e.g., 'Network', 'Runtime', etc.).- Code:
- Exact Field Declaration Expression:
public final String name;
-
description
public final java.lang.String description
Human-readable description extracted from the spec; may be empty if not provided.- Code:
- Exact Field Declaration Expression:
public final String description;
-
ownerAPI
-
propNames
public final ReadOnlyList<PropName> propNames
Complete list of top-level JSON property names present within the definition for this domain'sJsonObject.- Code:
- Exact Field Declaration Expression:
public final ReadOnlyList<PropName> propNames;
-
experimental
public final boolean experimental
TRUEif the spec marks this domain as experimental.- Code:
- Exact Field Declaration Expression:
public final boolean experimental;
-
deprecated
public final boolean deprecated
TRUEif the spec marks this domain as deprecated.- Code:
- Exact Field Declaration Expression:
public final boolean deprecated;
-
types
public final ReadOnlyList<TypeNode> types
All type definitions declared under this domain, parsed and extracted intoTypeNodeinstances.- Code:
- Exact Field Declaration Expression:
public final ReadOnlyList<TypeNode> types;
-
commands
public final ReadOnlyList<CommandNode> commands
All type definitions declared under this domain, parsed and extracted intoCommandNodeinstances.- Code:
- Exact Field Declaration Expression:
public final ReadOnlyList<CommandNode> commands;
-
events
public final ReadOnlyList<EventNode> events
All type definitions declared under this domain, parsed and extracted intoEventNodeinstances.- Code:
- Exact Field Declaration Expression:
public final ReadOnlyList<EventNode> events;
-
depAsStrs
public final ReadOnlyList<java.lang.String> depAsStrs
Raw "dependencies" array preserved from the spec asjava.lang.String's. These dependencies are not actually used anywhere in this code, but they are linked into actualDomainreferences, and can be obtained by invokinggetDependencies()- Code:
- Exact Field Declaration Expression:
public final ReadOnlyList<String> depAsStrs;
-
-
Method Detail
-
getDependencies
public ReadOnlyList<Domain> getDependencies()
The list of dependent domains. This is a method, rather than a publicfinalfield, because it's value is computed during the "Linking Phase" of the Build-Mechanism. Linking is simply where theString'Network'orRunTimeis actually converted to a pointer to the domain instance whose name is'Network'.
This cannot be done inside the constructor, because it all domains must be first constructed before their refeences can be assigned to this field! (Remember,finalfields in a class must always be assigned befeore the object's constructor has finished.)- Code:
- Exact Method Body:
return dependencies;
-
toString
public java.lang.String toString()
Generates a fullStringrepresentation ofthisinstance.- Overrides:
toStringin classjava.lang.Object- Code:
- Exact Method Body:
return StringDomain.get(this);
-
hashCode
-
compareTo
public int compareTo(Domain other)
Checksnamefields, using the standardString.compareToto produce a comparison value.- Specified by:
compareToin interfacejava.lang.Comparable<Domain>- Code:
- Exact Method Body:
if (other == null) return 1; if (this.id == other.id) return 0; return (this.ownerAPI.id != other.ownerAPI.id) ? this.ownerAPI.name.compareTo(other.ownerAPI.name) : this.name.compareTo(other.name);
-
equals
-
-