Class 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 the JsonAST-Package. It is easy to load the Abstract Syntax Tree's from disk by invoking the deserializeFromJAR() method inside of class SERIALIZED_AST. Remember that the entire package Torello.Browser.JsonAST is 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 JSON and JavaScript 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 into ReadOnlyList's from the ReadOnly 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.

    API
    Domain
    
    Entity
    ├─ TCE  (abstract)
    │  ├─ TypeNode
    │  ├─ CommandNode
    │  └─ EventNode
    └─ PPR
    



    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 six JsonObject properties are mapped to the following Entity subclasses:
    Json Object Type AST Node Java Conversion "Target"
    Type TypeNode Converted into Java Inner Classes / Nested Types of the Primary Domain Java-Classes
    Command CommandNode Converted into Java Methods within the Primary Domain Java-Classes
    Event EventNode Also Converted into Inner Classes / Nested Types of the Primary Domain Java-Classes
    Property PPR Converted into typical Java Fields within the Inner Types / Nested Classes.
    (See note †† below.)
    Parameter PPR For 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 PPR These are converted (for Commands), into Return-Values for the Methods. Using the "Multi-Return Tuples" RetN defined in the Java.Additional package, it is possible (and quite common, actually) to return multiple values from a single method invocation.
    (See note †† below.)

    †† Unlike TCE, Properties, Parameters, and Return-Values do not have their own dedicated AST nodes, because their content is always identical to that in base class PPR.
    See Also:
    Serialized Form


    • Field Summary

       
      Serializable ID
      Modifier and Type Field Description
      protected static long serialVersionUID  
       
      Core Identity: Fundamental Details of this Domain
      Modifier and Type Field Description
      String description
      Human-readable description extracted from the spec; may be empty if not provided.
      int id
      Unique process-local identifier for this domain instance, assigned internally by IDManager.nextID()
      String name
      Domain name taken from the spec’s "domain" property (e.g., 'Network', 'Runtime', etc.).
      API ownerAPI
      Owning API this domain belongs to (Browser API or JavaScript API).
      ReadOnlyList<PropName> propNames
      Complete list of top-level JSON property names present within the definition for this domain's JsonObject.
       
      Lifecycle Flags: Markers / Flags Ascribed to this Domain by the Google API Definition File
      Modifier and Type Field Description
      boolean deprecated
      TRUE if the spec marks this domain as deprecated.
      boolean experimental
      TRUE if 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> commands
      All type definitions declared under this domain, parsed and extracted into CommandNode instances.
      ReadOnlyList<EventNode> events
      All type definitions declared under this domain, parsed and extracted into EventNode instances.
      ReadOnlyList<TypeNode> types
      All type definitions declared under this domain, parsed and extracted into TypeNode instances.
       
      Unused, but Parsed: List of Domains upon which this Domain Depends
      Modifier and Type Field Description
      ReadOnlyList<String> depAsStrs
      Raw "dependencies" array preserved from the spec as String'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
      int compareTo​(Domain other)
      Checks name fields, using the standard String.compareTo to produce a comparison value.
       
      Methods: class java.lang.Object
      Modifier and Type Method Description
      boolean equals​(Object other)
      Checks this.id against other.id for equality.
      int hashCode()
      Utilizes this.id as a hash; it is a unique value across the AST Tree.
      String toString()
      Generates a full String representation of this instance.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • id

        🡅  🡇     🗕  🗗  🗖
        public final int id
        Unique process-local identifier for this domain instance, assigned internally by IDManager.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

        🡅  🡇     🗕  🗗  🗖
        public final API ownerAPI
        Owning API this domain belongs to (Browser API or JavaScript API).
        Code:
        Exact Field Declaration Expression:
         public final API ownerAPI;
        
      • experimental

        🡅  🡇     🗕  🗗  🗖
        public final boolean experimental
        TRUE if the spec marks this domain as experimental.
        Code:
        Exact Field Declaration Expression:
         public final boolean experimental;
        
      • deprecated

        🡅  🡇     🗕  🗗  🗖
        public final boolean deprecated
        TRUE if the spec marks this domain as deprecated.
        Code:
        Exact Field Declaration Expression:
         public final boolean deprecated;
        
      • depAsStrs

        🡅  🡇     🗕  🗗  🗖
        public final ReadOnlyList<java.lang.String> depAsStrs
        Raw "dependencies" array preserved from the spec as java.lang.String's. These dependencies are not actually used anywhere in this code, but they are linked into actual Domain references, and can be obtained by invoking getDependencies()
        Code:
        Exact Field Declaration Expression:
         public final ReadOnlyList<String> depAsStrs;
        
    • Method Detail

      • getDependencies

        🡅  🡇     🗕  🗗  🗖
        public ReadOnlyList<DomaingetDependencies()
        The list of dependent domains. This is a method, rather than a public final field, because it's value is computed during the "Linking Phase" of the Build-Mechanism. Linking is simply where the String 'Network' or RunTime is 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, final fields in a class must always be assigned befeore the object's constructor has finished.)
        Code:
        Exact Method Body:
         return dependencies;
        
      • toString

        🡅  🡇         External-Java:    🗕  🗗  🗖
        public java.lang.String toString()
        Generates a full String representation of this instance.
        Overrides:
        toString in class java.lang.Object
        Code:
        Exact Method Body:
         return StringDomain.get(this);
        
      • hashCode

        🡅  🡇     🗕  🗗  🗖
        public int hashCode()
        Utilizes this.id as a hash; it is a unique value across the AST Tree.
        Overrides:
        hashCode in class java.lang.Object
        Code:
        Exact Method Body:
         return id;
        
      • compareTo

        🡅  🡇     🗕  🗗  🗖
        public int compareTo​(Domain other)
        Checks name fields, using the standard String.compareTo to produce a comparison value.
        Specified by:
        compareTo in interface java.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

        🡅     🗕  🗗  🗖
        public boolean equals​(java.lang.Object other)
        Checks this.id against other.id for equality.
        Overrides:
        equals in class java.lang.Object
        Code:
        Exact Method Body:
         if (other == null)              return false;
         if (!(other instanceof Domain)) return false;
         return this.id == ((Domain) other).id;