Package: groovy.console.ui

## [Groovy] Class ScriptToTreeNodeAdapter

- groovy.console.ui.ScriptToTreeNodeAdapter

-     class ScriptToTreeNodeAdapter
      extends Object

  This class controls the conversion from a Groovy script as a String into a tree representation of the AST of that script. The script itself will be a tree node, and each class in the script will be a tree node. The conversion creates tree nodes for any concrete class found within an AST visitor. So, if a tree node should be shown once for each ASTNode and the parent types will not appear as nodes. Custom subclasses of expression types will not appear in the tree. The String label of a tree node is defined by classname in AstBrowserProperties.properties.

- - ### Properties Summary

    Properties
    Type | Name and description
    --- | ---
    `GroovyClassLoader` | `classLoader` Class loader used for script compilation.
    `static Properties` | `classNameToStringForm` Maps AST node class names to display templates.
    `AstBrowserNodeMaker` | `nodeMaker` Factory used to create tree node instances.
    `boolean` | `showClosureClasses` Display flags that control which script structures are included.
    `boolean` | `showScriptClass` Display flags that control which script structures are included.
    `boolean` | `showScriptFreeForm` Display flags that control which script structures are included.

  - ### Constructor Summary

    Constructors
    Constructor and description
    `ScriptToTreeNodeAdapter(Object classLoader, Object showScriptFreeForm, Object showScriptClass, Object showClosureClasses, Object nodeMaker, Object config)` Creates an adapter for the supplied compilation settings.

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `Object` | `compile(String script, int compilePhase)` Performs the conversion from script to TreeNode.
    `` | `void` | `extendMethodNodePropertyTable(List<List<?>> table, MethodNode node)` Extends the method node property table by adding custom properties.
    `` | `Object` | `make(Object node)` Creates a tree node for the supplied AST node.
    `` | `Object` | `make(MethodNode node)` Creates a tree node for a method node with its descriptor metadata.
    `` | `String` | `toString(Object o)`

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Object` | `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Property Detail

    - #### final GroovyClassLoader classLoader

      Class loader used for script compilation.

    - #### static Properties classNameToStringForm

      Maps AST node class names to display templates.

    - #### final AstBrowserNodeMaker nodeMaker

      Factory used to create tree node instances.

    - #### boolean showClosureClasses

      Display flags that control which script structures are included.

    - #### boolean showScriptClass

      Display flags that control which script structures are included.

    - #### boolean showScriptFreeForm

      Display flags that control which script structures are included.

  - ### Constructor Detail

    - #### ScriptToTreeNodeAdapter(Object classLoader, Object showScriptFreeForm, Object showScriptClass, Object showClosureClasses, Object nodeMaker, Object config)

      Creates an adapter for the supplied compilation settings.

      Parameters:
        `classLoader` - class loader used for compilation
        `showScriptFreeForm` - whether to include free-form script statements
        `showScriptClass` - whether to include the generated script class
        `showClosureClasses` - whether to include generated closure classes
        `nodeMaker` - node factory used for tree creation
        `config` - optional compiler configuration

  - ### Method Detail

    - #### Object compile(String script, int compilePhase)

      Performs the conversion from script to TreeNode.

      Parameters:
        `script` - a Groovy script in String form
        `compilePhase` - the int based CompilePhase to compile it to.
      Returns:
        the generated tree root

    - #### void extendMethodNodePropertyTable(List<List<?>> table, MethodNode node)

      Extends the method node property table by adding custom properties.

      Parameters:
        `table` - property table to extend
        `node` - method node supplying the descriptor

    - #### Object make(Object node)

      Creates a tree node for the supplied AST node.

      Parameters:
        `node` - AST node to adapt
      Returns:
        the created tree node

    - #### Object make(MethodNode node)

      Creates a tree node for a method node with its descriptor metadata.

      Parameters:
        `node` - method node to adapt
      Returns:
        the created tree node

    - #### @CompileStatic
      String toString(Object o)