Package Torello.Browser.JsonAST
Class Helper$FindTypeNode
- java.lang.Object
-
- Torello.Browser.JsonAST.Helper$FindTypeNode
-
public class Helper$FindTypeNode extends java.lang.Object
The contents of theJsonAST-Package are, in general, provided strictly for informational & reference purposes. If further research & investigation of Google's CDP API are necessary, one may deserialize theBrowser-APIand / or theJavaScript-APIfrom the Java-HTML'.jar'file, and review the AST's programmatically. The AST Node Java-Classes have been meticulously documented exactly for that purpose.
Generally, though, there really is very little need to review, understand, or programmatically analyze the CDP API. And the contents of this entire package, again, are largely here for reference only.
This particular class falls under the Package "Sub-Category" known as"The Linker". Linking variables inside of an AST is an extremely simple concept, but has one issue of utmost importance to bear in mind. Converting Google's CDP API from a'.json'definition file ( browser_protocol.jsonandjs_protocol.json) into an Abstract Syntax Memory inside of Java Program Memory is really all about converting thousands upon thousands ofString'sinto actual POJO References. The Process otherwise known as "Linking" is simply where one class has a "Type" (which in Java is called a "Class") specified by someStringinto an actual pointer or reference to its definition (another or second "Class") somewhere else on the Java Heap. The Linker merely takes fields defined by strings, and converts them into fields defined by references, no more, no less.
The only issue to keep in mind, vis-à-vis "The Linker," is that one very common programming technique is to declare fields inside of a class with / using the Java reserved keywordfinal. However, since fields which need to be "linked" may only be assigned a value after all of the AST Nodes have been constructed, these fields cannot be assigned inside the constructor of an AST Node Class, itself. Therefore, and unfortunately, any field which requires linking cannot be declaredfinal.
Fields which can be modified (non-final fields), often (but not always), must also be declaredprivateto protect their value from accidental user clobbering or modification. For these reasons, along with others not mentioned, it is much easier to isolate classes for "The Linker", externally into separate Java Class Files.Converts a single type reference as aStringinto a genuineTypeNodeinstance.
Class PPR is used to define to allow the Json API to define- Java Static Inner Class' Fields for
TypeNode's
- Java Static Inner Class' Fields for
EventNode's
CDP calls Fields which are ascribed Event Classes by the termparametersrather thanpropertiesfor some odd reason.
CommandNode'sactually have two kinds ofPPR'sinstances: Java Method-Parameters and Method Return Values.
PPR instances which require linking expect to have NON-NULL String field values assigned to their internal fields:refandrefArrayThese two fields are linked, meaning theirString-representations are converted into object references to classTypeNode. During the linking phase, each domain is searched for aTypeNodewhosenamefield equals'ref'or'refArray'.
Reference Array:
Note that for a non-null 'referenceArray' field, this requires that the original JsonObjet- a
"type"property having the value"array" - a subsequent
"items"property (also aJsonObject) which contains a"$ref"property that names a CDP defined type. - and of course an actual value for
"$ref"that names another CDP Type.
An Example PPR that has a "refArr" String which needs to be "linked" (to a 'referenceArray')
Example:
/** * One or more related nodes, if applicable. * <BR /><B CLASS=Opt>OPTIONAL</B> */ public final Accessibility.AXRelatedNode[] relatedNodes;
The above code snippet is aPPRobject which the Code Generator produced using the following JSON definition.
Java Script Object Notation (JSON):
{ "name": "relatedNodes", "description": "One or more related nodes, if applicable.", "optional": true, "type": "array", "items": { "$ref": "AXRelatedNode" } }
Hi-Lited Source-Code:- View Here: Torello/Browser/JsonAST/Helper$FindTypeNode.java
- Open New Browser-Tab: Torello/Browser/JsonAST/Helper$FindTypeNode.java
File Size: 2,377 Bytes Line Count: 58 '\n' Characters Found
Stateless Class:This class neither contains any program-state, nor can it be instantiated. The@StaticFunctionalAnnotation may also be called 'The Spaghetti Report'.Static-Functionalclasses are, essentially, C-Styled Files, without any constructors or non-static member fields. It is a concept very similar to the Java-Bean's@StatelessAnnotation.
- 1 Constructor(s), 1 declared private, zero-argument constructor
- 1 Method(s), 1 declared static
- 0 Field(s)
- Java Static Inner Class' Fields for