- org.codehaus.groovy.ast.ModuleNode
-
- All Implemented Interfaces and Traits:
- org.objectweb.asm.Opcodes
public class ModuleNode
extends ASTNode
implements org.objectweb.asm.Opcodes
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
-
-
Methods Summary
Methods
Type Params |
Return Type |
Name and description |
|
void |
addClass(ClassNode node)
|
|
void |
addImport(String alias, ClassNode type)
|
|
void |
addImport(String alias, ClassNode type, List<AnnotationNode> annotations)
|
|
void |
addMethod(MethodNode node)
|
|
void |
addStarImport(String packageName)
|
|
void |
addStarImport(String packageName, List<AnnotationNode> annotations)
|
|
void |
addStatement(Statement node)
|
|
void |
addStaticImport(ClassNode type, String fieldName, String alias)
|
|
void |
addStaticImport(ClassNode type, String fieldName, String alias, List<AnnotationNode> annotations)
|
|
void |
addStaticStarImport(String name, ClassNode type)
|
|
void |
addStaticStarImport(String name, ClassNode type, List<AnnotationNode> annotations)
|
|
protected ClassNode |
createStatementsClass()
|
|
protected String |
extractClassFromFileDescription()
|
|
List<ClassNode> |
getClasses()
|
|
SourceUnit |
getContext()
|
|
String |
getDescription() - Returns:
- the underlying character stream description
|
|
ImportNode |
getImport(String alias) - Parameters:
alias - the name of interest
|
|
ClassNode |
getImportType(String alias) - Parameters:
alias - the name of interest
|
|
List<ImportNode> |
getImports()
|
|
String |
getMainClassName()
|
|
List<MethodNode> |
getMethods()
|
|
PackageNode |
getPackage()
|
|
String |
getPackageName()
|
|
ClassNode |
getScriptClassDummy()
|
|
List<ImportNode> |
getStarImports()
|
|
BlockStatement |
getStatementBlock()
|
|
Map<String, ImportNode> |
getStaticImports()
|
|
Map<String, ImportNode> |
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)
|
-
Inherited Methods Summary
Inherited Methods
Methods inherited from class |
Name |
class ASTNode |
copyNodeMetaData, getColumnNumber, getLastColumnNumber, getLastLineNumber, getLineNumber, getMetaDataMap, getText, hashCode, setColumnNumber, setLastColumnNumber, setLastLineNumber, setLineNumber, setMetaDataMap, setSourcePosition, visit |
-
-
Method Detail
-
public void addStarImport(String packageName)
-
protected String extractClassFromFileDescription()
-
public String getDescription()
- Returns:
- the underlying character stream description
-
- Parameters:
alias
- the name of interest
- Returns:
- the import node for the given alias or null if none is available
-
- Parameters:
alias
- the name of interest
- Returns:
- the class node for the given alias or null if none is available
-
public String getMainClassName()
-
public String getPackageName()
-
public boolean hasImportsResolved()
-
public boolean hasPackage()
-
public boolean hasPackageName()
-
public void setDescription(String description)
-
public void setImportsResolved(boolean importsResolved)
-
public void setPackageName(String packageName)
-
public void sortClasses()
Copyright © 2003-2020 The Apache Software Foundation. All rights reserved.