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 and description |
---|
ModuleNode(SourceUnit context) |
ModuleNode(CompileUnit unit) |
Type Params | Return Type | Name and description |
---|---|---|
|
public void |
addClass(ClassNode node) |
|
public void |
addImport(String alias, ClassNode type) |
|
public void |
addImport(String alias, ClassNode type, List<AnnotationNode> annotations) |
|
public void |
addMethod(MethodNode node) |
|
public void |
addStarImport(String packageName) |
|
public void |
addStarImport(String packageName, List<AnnotationNode> annotations) |
|
public void |
addStatement(Statement node) |
|
public void |
addStaticImport(ClassNode type, String fieldName, String alias) |
|
public void |
addStaticImport(ClassNode type, String fieldName, String alias, List<AnnotationNode> annotations) |
|
public void |
addStaticStarImport(String name, ClassNode type) |
|
public void |
addStaticStarImport(String name, ClassNode type, List<AnnotationNode> annotations) |
|
public List<ClassNode> |
getClasses() |
|
public SourceUnit |
getContext() |
|
public String |
getDescription()
|
|
public ImportNode |
getImport(String alias)
|
|
public ClassNode |
getImportType(String alias)
|
|
public List<ImportNode> |
getImports()
|
|
public String |
getMainClassName() |
|
public List<MethodNode> |
getMethods()
|
|
public PackageNode |
getPackage() |
|
public String |
getPackageName() |
|
public ClassNode |
getScriptClassDummy() |
|
public List<ImportNode> |
getStarImports()
|
|
public BlockStatement |
getStatementBlock() |
|
public Map<String, ImportNode> |
getStaticImports()
|
|
public Map<String, ImportNode> |
getStaticStarImports()
|
|
public CompileUnit |
getUnit() |
|
public boolean |
hasImportsResolved() |
|
public boolean |
hasPackage() |
|
public boolean |
hasPackageName() |
|
public boolean |
isEmpty() |
|
public void |
setDescription(String description) |
|
public void |
setImportsResolved(boolean importsResolved) |
|
public void |
setPackage(PackageNode packageNode) |
|
public void |
setPackageName(String packageName) |
|
public void |
sortClasses() |
|
public void |
visit(GroovyCodeVisitor visitor) |
Methods inherited from class | Name |
---|---|
class ASTNode |
copyNodeMetaData, getColumnNumber, getLastColumnNumber, getLastLineNumber, getLineNumber, getMetaDataMap, getText, setColumnNumber, setLastColumnNumber, setLastLineNumber, setLineNumber, setMetaDataMap, setSourcePosition, visit |
alias
- the name of interest
alias
- the name of interest
Copyright © 2003-2022 The Apache Software Foundation. All rights reserved.