Groovy 2.2.1

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)

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

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 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, putNodeMetaData, 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)


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)


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


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


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-2013 The Codehaus. All rights reserved.