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

## org.codehaus.groovy.ast
[Java] Class ModuleNode

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

All Implemented Interfaces:
  org.objectweb.asm.Opcodes

    public 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

Authors:
  Jochen Theodorou
  Paul King
  James Strachan

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)` @deprecated replaced by addStarImport(String)
`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)` @deprecated replaced by addStaticStarImport(String, ClassNode)
`void` | `addStaticMethodOrField(ClassNode type, String fieldName, String alias)` @deprecated replaced by addStaticImport(ClassNode, String, String)
`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()` @return the underlying character stream description
`ImportNode` | `getImport(String alias)` @param alias the name of interest
`List` | `getImportPackages()` @deprecated replaced by getStarImports()
`ClassNode` | `getImportType(String alias)` @param alias the name of interest
`List` | `getImports()`
`String` | `getMainClassName()`
`List` | `getMethods()`
`PackageNode` | `getPackage()`
`String` | `getPackageName()`
`ClassNode` | `getScriptClassDummy()`
`List` | `getStarImports()`
`BlockStatement` | `getStatementBlock()`
`Map` | `getStaticImportAliases()` @deprecated replaced by getStaticImports()
`Map` | `getStaticImportClasses()` @deprecated replaced by getStaticStarImports()
`Map` | `getStaticImportFields()` @deprecated replaced by getStaticImports()
`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` | `sortClasses()`
`void` | `visit(GroovyCodeVisitor visitor)`

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

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

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()

  Returns:
    the underlying character stream description

### getImport

    public ImportNode getImport(String alias)

  Parameters:
    `alias` - the name of interest
  Returns:
    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)

  Parameters:
    `alias` - the name of interest
  Returns:
    the class node for the given alias or null if none is available

### getImports

    public List getImports()

### getMainClassName

    public String getMainClassName()

### 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)

### sortClasses

    public void sortClasses()

### visit

    public void visit(GroovyCodeVisitor visitor)

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