Class TCE

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<Entity>
    Direct Known Subclasses:
    CommandNode, EventNode, TypeNode

    public abstract class TCE
    extends Entity
    implements java.io.Serializable
    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.
    Class TCE serves as the common denominator for three inheriting, child classes: TypeNode, CommandNode & EventNode.

    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 Detail

      • serialVersionUID

        🡇     🗕  🗗  🗖
        protected static final long serialVersionUID
        This fulfils the SerialVersion UID requirement for all classes that implement Java's interface java.io.Serializable. Using the Serializable Implementation offered by java is very easy, and can make saving program state when debugging a lot easier. It can also be used in place of more complicated systems like "hibernate" to store data as well.
        See Also:
        Constant Field Values
        Code:
        Exact Field Declaration Expression:
         protected static final long serialVersionUID = 1;
        
      • which

        🡅  🡇     🗕  🗗  🗖
        public final WhichTCE which
        Contains a simple 'enum' constant which Indicates whether 'this' TCE instance has been parsed a "types", "commands" or an "events" array.
        Code:
        Exact Field Declaration Expression:
         public final WhichTCE which;
        
    • Method Detail

      • toStringShort

        🡅     🗕  🗗  🗖
        public java.lang.String toStringShort()
        An abbreviated String representation of this class.
        Code:
        Exact Method Body:
         return
             this.ownerDomain.ownerAPI.name + '.' +  // API-Name
             this.ownerDomain.name + '.' +           // Domain-Name
             this.name + ' ' +                       // TCE-Name
             "[#" + this.id + ", WhichTCE." + this.which + ']';