- org.codehaus.groovy.ast.ModuleNode
-
- All Implemented Interfaces and Traits:
- 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
-
-
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()
|
|
org.codehaus.groovy.control.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<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, copyNodeMetaData, equals, getColumnNumber, getLastColumnNumber, getLastLineNumber, getLineNumber, getMetaDataMap, getNodeMetaData, getNodeMetaData, getText, hashCode, putNodeMetaData, removeNodeMetaData, setColumnNumber, setLastColumnNumber, setLastLineNumber, setLineNumber, setMetaDataMap, setNodeMetaData, setSourcePosition, visit |
class Object |
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll |
-
-
Constructor Detail
-
public ModuleNode(org.codehaus.groovy.control.SourceUnit context)
-
Method Detail
-
public void addStarImport(String packageName)
-
protected String extractClassFromFileDescription()
-
public org.codehaus.groovy.control.SourceUnit getContext()
-
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-2018 The Apache Software Foundation. All rights reserved.