|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.codehaus.groovy.ast.ASTNode org.codehaus.groovy.ast.ModuleNode
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
Constructor Summary | |
ModuleNode(SourceUnit context)
|
|
ModuleNode(CompileUnit unit)
|
Method Summary | |
---|---|
void
|
addClass(ClassNode node)
|
void
|
addImport(java.lang.String alias, ClassNode type)
|
void
|
addImport(java.lang.String alias, ClassNode type, java.util.List annotations)
|
void
|
addMethod(MethodNode node)
|
void
|
addStarImport(java.lang.String packageName)
|
void
|
addStarImport(java.lang.String packageName, java.util.List annotations)
|
void
|
addStatement(Statement node)
|
void
|
addStaticImport(ClassNode type, java.lang.String fieldName, java.lang.String alias)
|
void
|
addStaticImport(ClassNode type, java.lang.String fieldName, java.lang.String alias, java.util.List annotations)
|
void
|
addStaticStarImport(java.lang.String name, ClassNode type)
|
void
|
addStaticStarImport(java.lang.String name, ClassNode type, java.util.List annotations)
|
protected ClassNode
|
createStatementsClass()
|
protected java.lang.String
|
extractClassFromFileDescription()
|
java.util.List
|
getClasses()
|
SourceUnit
|
getContext()
|
java.lang.String
|
getDescription()
@return the underlying character stream description |
ImportNode
|
getImport(java.lang.String alias)
@param alias the name of interest |
ClassNode
|
getImportType(java.lang.String alias)
@param alias the name of interest |
java.util.List
|
getImports()
|
java.lang.String
|
getMainClassName()
|
java.util.List
|
getMethods()
|
PackageNode
|
getPackage()
|
java.lang.String
|
getPackageName()
|
ClassNode
|
getScriptClassDummy()
|
java.util.List
|
getStarImports()
|
BlockStatement
|
getStatementBlock()
|
java.util.Map
|
getStaticImports()
|
java.util.Map
|
getStaticStarImports()
|
CompileUnit
|
getUnit()
|
boolean
|
hasImportsResolved()
|
boolean
|
hasPackage()
|
boolean
|
hasPackageName()
|
boolean
|
isEmpty()
|
void
|
setDescription(java.lang.String description)
|
void
|
setImportsResolved(boolean importsResolved)
|
void
|
setPackage(PackageNode packageNode)
|
void
|
setPackageName(java.lang.String packageName)
|
void
|
sortClasses()
|
void
|
visit(GroovyCodeVisitor visitor)
|
Methods inherited from class java.lang.Object | |
---|---|
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Constructor Detail |
---|
public ModuleNode(SourceUnit context)
public ModuleNode(CompileUnit unit)
Method Detail |
---|
public void addClass(ClassNode node)
public void addImport(java.lang.String alias, ClassNode type)
public void addImport(java.lang.String alias, ClassNode type, java.util.List annotations)
public void addMethod(MethodNode node)
public void addStarImport(java.lang.String packageName)
public void addStarImport(java.lang.String packageName, java.util.List annotations)
public void addStatement(Statement node)
public void addStaticImport(ClassNode type, java.lang.String fieldName, java.lang.String alias)
public void addStaticImport(ClassNode type, java.lang.String fieldName, java.lang.String alias, java.util.List annotations)
public void addStaticStarImport(java.lang.String name, ClassNode type)
public void addStaticStarImport(java.lang.String name, ClassNode type, java.util.List annotations)
protected ClassNode createStatementsClass()
protected java.lang.String extractClassFromFileDescription()
public java.util.List getClasses()
public SourceUnit getContext()
public java.lang.String getDescription()
public ImportNode getImport(java.lang.String alias)
alias
- the name of interest
public ClassNode getImportType(java.lang.String alias)
alias
- the name of interest
public java.util.List getImports()
public java.lang.String getMainClassName()
public java.util.List getMethods()
public PackageNode getPackage()
public java.lang.String getPackageName()
public ClassNode getScriptClassDummy()
public java.util.List getStarImports()
public BlockStatement getStatementBlock()
public java.util.Map getStaticImports()
public java.util.Map getStaticStarImports()
public CompileUnit getUnit()
public boolean hasImportsResolved()
public boolean hasPackage()
public boolean hasPackageName()
public boolean isEmpty()
public void setDescription(java.lang.String description)
public void setImportsResolved(boolean importsResolved)
public void setPackage(PackageNode packageNode)
public void setPackageName(java.lang.String packageName)
public void sortClasses()
public void visit(GroovyCodeVisitor visitor)
Groovy Documentation