org.codehaus.groovy.syntax

## Class ASTHelper

- java.lang.Object
- - org.codehaus.groovy.syntax.ASTHelper

- Direct Known Subclasses:
    AntlrParserPlugin

      public class ASTHelper
      extends Object

  A common base class of AST helper methods which can be shared across the classic and new parsers
  Author:
    Jochen Theodorou, James Strachan, Bob McWhirter, Sam Pullara, Chris Poirier

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected ModuleNode` | `output`
    `protected static Map` | `resolutions`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ASTHelper()`
    `ASTHelper(SourceUnit controller, ClassLoader classLoader)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `addImport(ClassNode type, String name, String aliasName)`
    `protected void` | `addImport(ClassNode type, String name, String aliasName, List<AnnotationNode> annotations)`
    `protected void` | `addStarImport(String importPackage)`
    `protected void` | `addStarImport(String importPackage, List<AnnotationNode> annotations)`
    `protected void` | `addStaticImport(ClassNode type, String name, String alias)`
    `protected void` | `addStaticImport(ClassNode type, String name, String alias, List<AnnotationNode> annotations)`
    `protected void` | `addStaticStarImport(ClassNode type, String importClass)`
    `protected void` | `addStaticStarImport(ClassNode type, String importClass, List<AnnotationNode> annotations)`
    `protected String` | `dot(String base)` A synonym for `dot( base, "" )`.
    `static String` | `dot(String base, String name)`
    `ClassLoader` | `getClassLoader()` Returns our class loader (as supplied on construction).
    `SourceUnit` | `getController()`
    `String` | `getPackageName()`
    `protected void` | `makeModule()`
    `void` | `setClassLoader(ClassLoader classLoader)`
    `void` | `setController(SourceUnit controller)`
    `PackageNode` | `setPackage(String packageName, List<AnnotationNode> annotations)`
    `void` | `setPackageName(String packageName)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### output

          protected ModuleNode output

    - #### resolutions

          protected static Map resolutions

  - ### Constructor Detail

    - #### ASTHelper

          public ASTHelper(SourceUnit controller,
                   ClassLoader classLoader)

    - #### ASTHelper

          public ASTHelper()

  - ### Method Detail

    - #### getPackageName

          public String getPackageName()

    - #### setPackageName

          public void setPackageName(String packageName)

    - #### setPackage

          public PackageNode setPackage(String packageName,
                               List<AnnotationNode> annotations)

    - #### getClassLoader

          public ClassLoader getClassLoader()

      Returns our class loader (as supplied on construction).

    - #### setClassLoader

          public void setClassLoader(ClassLoader classLoader)

    - #### getController

          public SourceUnit getController()

    - #### setController

          public void setController(SourceUnit controller)

    - #### dot

          public static String dot(String base,
                   String name)

      Parameters:
        `base` - typically a package
        `name` - typically a simple unqualified class name
      Returns:
        Two names joined by a dot. If the base name is empty, returns the name unchanged.

    - #### makeModule

          protected void makeModule()

    - #### dot

          protected String dot(String base)

      A synonym for `dot( base, "" )`.

    - #### addImport

          protected void addImport(ClassNode type,
                       String name,
                       String aliasName)

    - #### addImport

          protected void addImport(ClassNode type,
                       String name,
                       String aliasName,
                       List<AnnotationNode> annotations)

    - #### addStaticImport

          protected void addStaticImport(ClassNode type,
                             String name,
                             String alias)

    - #### addStaticImport

          protected void addStaticImport(ClassNode type,
                             String name,
                             String alias,
                             List<AnnotationNode> annotations)

    - #### addStaticStarImport

          protected void addStaticStarImport(ClassNode type,
                                 String importClass)

    - #### addStaticStarImport

          protected void addStaticStarImport(ClassNode type,
                                 String importClass,
                                 List<AnnotationNode> annotations)

    - #### addStarImport

          protected void addStarImport(String importPackage)

    - #### addStarImport

          protected void addStarImport(String importPackage,
                           List<AnnotationNode> annotations)