Overview | Package | Class | Deprecated | Index | Help
| Groovy 1.7.0
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.codehaus.groovy.ast
Class ModuleNode

    java.lang.Object
      org.codehaus.groovy.ast.ASTNode
          org.codehaus.groovy.ast.ModuleNode

All Implemented Interfaces:
  org.objectweb.asm.Opcodes

    class ModuleNode
    extends ASTNode

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:
  Paul King

author:
  James Strachan

Field Summary
`List` | `classes`

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

Method Summary
`void` | `addClass(ClassNode node)`
`void` | `addImport(String alias, ClassNode type)`
`void` | `addImport(String alias, ClassNode type, List annotations)`
`String[]` | `addImportPackage(String packageName)`
`void` | `addMethod(MethodNode node)`
`void` | `addStarImport(String packageName)`
`void` | `addStarImport(String packageName, List annotations)`
`void` | `addStatement(Statement node)`
`void` | `addStaticImport(ClassNode type, String fieldName, String alias)`
`void` | `addStaticImport(ClassNode type, String fieldName, String alias, List annotations)`
`void` | `addStaticImportClass(String name, ClassNode type)`
`void` | `addStaticMethodOrField(ClassNode type, String fieldName, String alias)`
`void` | `addStaticStarImport(String name, ClassNode type)`
`void` | `addStaticStarImport(String name, ClassNode type, List annotations)`
`protected ClassNode` | `createStatementsClass()`
`protected String` | `extractClassFromFileDescription()`
`List` | `getClasses()`
`SourceUnit` | `getContext()`
`String` | `getDescription()`
`ImportNode` | `getImport(String alias)`
`List` | `getImportPackages()`
`ClassNode` | `getImportType(String alias)`
`List` | `getImports()`
`List` | `getMethods()`
`PackageNode` | `getPackage()`
`String` | `getPackageName()`
`ClassNode` | `getScriptClassDummy()`
`List` | `getStarImports()`
`BlockStatement` | `getStatementBlock()`
`Map` | `getStaticImportAliases()`
`Map` | `getStaticImportClasses()`
`Map` | `getStaticImportFields()`
`Map` | `getStaticImports()`
`Map` | `getStaticStarImports()`
`CompileUnit` | `getUnit()`
`boolean` | `hasImportsResolved()`
`boolean` | `hasPackage()`
`boolean` | `hasPackageName()`
`boolean` | `isEmpty()`
`void` | `setDescription(String description)`
`void` | `setImportsResolved(boolean importsResolved)`
`void` | `setPackage(PackageNode packageNode)`
`void` | `setPackageName(String packageName)`
`void` | `setUnit(CompileUnit unit)`
`void` | `sortClasses()`
`void` | `visit(GroovyCodeVisitor visitor)`

Methods inherited from class ASTNode
getColumnNumber, getLastColumnNumber, getLastLineNumber, getLineNumber, getText, setColumnNumber, setLastColumnNumber, setLastLineNumber, setLineNumber, setSourcePosition, visit

Methods inherited from class Object
wait, wait, wait, hashCode, getClass, equals, toString, notify, notifyAll

Field Detail

### classes

    List classes

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)

### addImport

    public void addImport(String alias, ClassNode type, List annotations)

### addImportPackage

    @Deprecated
    public String[] addImportPackage(String packageName)

  deprecated:
    replaced by #addStarImport(String)

### addMethod

    public void addMethod(MethodNode node)

### addStarImport

    public void addStarImport(String packageName)

### addStarImport

    public void addStarImport(String packageName, List annotations)

### addStatement

    public void addStatement(Statement node)

### addStaticImport

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

### addStaticImport

    public void addStaticImport(ClassNode type, String fieldName, String alias, List annotations)

### addStaticImportClass

    @Deprecated
    public void addStaticImportClass(String name, ClassNode type)

  deprecated:
    replaced by #addStaticStarImport(String, ClassNode)

### addStaticMethodOrField

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

  deprecated:
    replaced by #addStaticImport(ClassNode, String, String)

### addStaticStarImport

    public void addStaticStarImport(String name, ClassNode type)

### addStaticStarImport

    public void addStaticStarImport(String name, ClassNode type, List annotations)

### createStatementsClass

    protected ClassNode createStatementsClass()

### extractClassFromFileDescription

    protected String extractClassFromFileDescription()

### getClasses

    public List getClasses()

### getContext

    public SourceUnit getContext()

### getDescription

    public String getDescription()

  return:
    the underlying character stream description

### getImport

    public ImportNode getImport(String alias)

  param:
    alias the name of interest
  return:
    the import node for the given alias or null if none is available

### getImportPackages

    @Deprecated
    public List getImportPackages()

  deprecated:
    replaced by #getStarImports()

### getImportType

    public ClassNode getImportType(String alias)

  param:
    alias the name of interest
  return:
    the class node for the given alias or null if none is available

### getImports

    public List getImports()

### getMethods

    public List getMethods()

### getPackage

    public PackageNode getPackage()

### getPackageName

    public String getPackageName()

### getScriptClassDummy

    public ClassNode getScriptClassDummy()

### getStarImports

    public List getStarImports()

### getStatementBlock

    public BlockStatement getStatementBlock()

### getStaticImportAliases

    @Deprecated
    public Map getStaticImportAliases()

  deprecated:
    replaced by #getStaticImports()

### getStaticImportClasses

    @Deprecated
    public Map getStaticImportClasses()

  deprecated:
    replaced by #getStaticStarImports()

### getStaticImportFields

    @Deprecated
    public Map getStaticImportFields()

  deprecated:
    replaced by #getStaticImports()

### getStaticImports

    public Map getStaticImports()

### getStaticStarImports

    public Map getStaticStarImports()

### getUnit

    public CompileUnit getUnit()

### hasImportsResolved

    public boolean hasImportsResolved()

### hasPackage

    public boolean hasPackage()

### hasPackageName

    public boolean hasPackageName()

### isEmpty

    public boolean isEmpty()

### setDescription

    public void setDescription(String description)

### setImportsResolved

    public void setImportsResolved(boolean importsResolved)

### setPackage

    public void setPackage(PackageNode packageNode)

### setPackageName

    public void setPackageName(String packageName)

### setUnit

    public void setUnit(CompileUnit unit)

### sortClasses

    public void sortClasses()

### visit

    public void visit(GroovyCodeVisitor visitor)

Copyright © 2003-2009 The Codehaus. All rights reserved.