Overview | Package | Class
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.codehaus.groovy.ast
Class ModuleNode

Represents a module, which consists typically of a class declaration but could include some imports, some statements and multiple classes intermixed with statements like scripts in Python or Ruby

author:
  Jochen Theodorou

author:
  James Strachan

version:
  $Revision: 9033 $

Field Summary
`def` | `EMPTY_STRING_ARRAY`
`List` | `classes`
`SourceUnit` | `context`
`boolean` | `createClassForStatements`
`String` | `description`
`Map` | `importIndex`
`List` | `importPackages`
`List` | `imports`
`boolean` | `importsResolved`
`List` | `methods`
`String` | `packageName`
`BlockStatement` | `statementBlock`
`Map` | `staticImportAliases`
`Map` | `staticImportClasses`
`Map` | `staticImportFields`
`CompileUnit` | `unit`

Constructor Summary
`ModuleNode(SourceUnit context)`
`ModuleNode(CompileUnit unit)`

Method Summary
`void` | `addClass(ClassNode node)`
`void` | `addImport(String alias, ClassNode type)`
`def` | `addImportPackage(String packageName)`
`void` | `addMethod(MethodNode node)`
`void` | `addStatement(Statement node)`
`void` | `addStaticImportClass(String name, ClassNode type)`
`void` | `addStaticMethodOrField(ClassNode type, String fieldName, String alias)`
`void` | `addToCompileUnit(ClassNode node)`
`ClassNode` | `createStatementsClass()`
`String` | `extractClassFromFileDescription()`
`List` | `getClasses()`
`SourceUnit` | `getContext()`
`String` | `getDescription()`
`ClassNode` | `getImport(String alias)`
`List` | `getImportPackages()`
`List` | `getImports()`
`List` | `getMethods()`
`String` | `getPackageName()`
`BlockStatement` | `getStatementBlock()`
`Map` | `getStaticImportAliases()`
`Map` | `getStaticImportClasses()`
`Map` | `getStaticImportFields()`
`CompileUnit` | `getUnit()`
`boolean` | `hasImportsResolved()`
`boolean` | `hasPackageName()`
`boolean` | `isEmpty()`
`void` | `setDescription(String description)`
`void` | `setImportsResolved(boolean importsResolved)`
`void` | `setPackageName(String packageName)`
`void` | `setUnit(CompileUnit unit)`
`void` | `sortClasses()`
`void` | `visit(GroovyCodeVisitor visitor)`

Constructor Detail

### ModuleNode

    public ModuleNode(SourceUnit context)

### ModuleNode

    public ModuleNode(CompileUnit unit)

Method Detail

### addClass

    public void addClass(ClassNode node)

### addImport

    public void addImport(String alias, ClassNode type)

### addImportPackage

    public def addImportPackage(String packageName)

### addMethod

    public void addMethod(MethodNode node)

### addStatement

    public void addStatement(Statement node)

### addStaticImportClass

    public void addStaticImportClass(String name, ClassNode type)

### addStaticMethodOrField

    public void addStaticMethodOrField(ClassNode type, String fieldName, String alias)

### addToCompileUnit

    void addToCompileUnit(ClassNode node)

  param:
    node

### createStatementsClass

    ClassNode createStatementsClass()

### extractClassFromFileDescription

    String extractClassFromFileDescription()

### getClasses

    public List getClasses()

### getContext

    public SourceUnit getContext()

### getDescription

    public String getDescription()

  return:
    the underlying character stream description

### getImport

    public ClassNode getImport(String alias)

  return:
    the class name for the given alias or null if none is available

### getImportPackages

    public List getImportPackages()

### getImports

    public List getImports()

### getMethods

    public List getMethods()

### getPackageName

    public String getPackageName()

### getStatementBlock

    public BlockStatement getStatementBlock()

### getStaticImportAliases

    public Map getStaticImportAliases()

### getStaticImportClasses

    public Map getStaticImportClasses()

### getStaticImportFields

    public Map getStaticImportFields()

### getUnit

    public CompileUnit getUnit()

### hasImportsResolved

    public boolean hasImportsResolved()

### hasPackageName

    public boolean hasPackageName()

### isEmpty

    public boolean isEmpty()

### setDescription

    public void setDescription(String description)

### setImportsResolved

    public void setImportsResolved(boolean importsResolved)

### setPackageName

    public void setPackageName(String packageName)

### setUnit

    public void setUnit(CompileUnit unit)

### sortClasses

    public void sortClasses()

### visit

    public void visit(GroovyCodeVisitor visitor)