Package org.codehaus.groovy.ast
Class ModuleNode
java.lang.Object
org.codehaus.groovy.ast.ASTNode
org.codehaus.groovy.ast.ModuleNode
- All Implemented Interfaces:
NodeMetaDataHandler
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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
void
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
protected String
getImportType
(String alias) getUnit()
boolean
boolean
boolean
boolean
isEmpty()
void
setDescription
(String description) void
setImportsResolved
(boolean importsResolved) void
setPackage
(PackageNode packageNode) void
setPackageName
(String packageName) void
void
visit
(GroovyCodeVisitor visitor) Methods inherited from class org.codehaus.groovy.ast.ASTNode
copyNodeMetaData, getColumnNumber, getLastColumnNumber, getLastLineNumber, getLineNumber, getMetaDataMap, getText, setColumnNumber, setLastColumnNumber, setLastLineNumber, setLineNumber, setMetaDataMap, setSourcePosition
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.codehaus.groovy.ast.NodeMetaDataHandler
copyNodeMetaData, getNodeMetaData, getNodeMetaData, getNodeMetaData, putNodeMetaData, removeNodeMetaData, setNodeMetaData
-
Constructor Details
-
ModuleNode
-
ModuleNode
-
-
Method Details
-
getClasses
-
getMethods
- Returns:
- the module's methods
-
getImports
- Returns:
- a copy of the module's imports
-
getStarImports
- Returns:
- the module's star imports
-
getStaticImports
- Returns:
- the module's static imports
-
getStaticStarImports
- Returns:
- the module's static star imports
-
getImportType
- Parameters:
alias
- the name of interest- Returns:
- the import type for the given alias or null if none is available
-
getImport
- Parameters:
alias
- the name of interest- Returns:
- the import node for the given alias or null if none is available
-
addImport
-
addImport
-
addStarImport
-
addStarImport
-
addStaticImport
-
addStaticImport
public void addStaticImport(ClassNode type, String fieldName, String alias, List<AnnotationNode> annotations) -
addStaticStarImport
-
addStaticStarImport
-
addStatement
-
addClass
-
addMethod
-
visit
-
getPackageName
-
getPackage
-
hasPackage
public boolean hasPackage() -
setPackage
-
hasPackageName
public boolean hasPackageName() -
setPackageName
-
getDescription
- Returns:
- the underlying character stream description
-
setDescription
-
getUnit
-
getContext
-
getScriptClassDummy
-
createStatementsClass
-
extractClassFromFileDescription
-
isEmpty
public boolean isEmpty() -
sortClasses
public void sortClasses() -
hasImportsResolved
public boolean hasImportsResolved() -
setImportsResolved
public void setImportsResolved(boolean importsResolved) -
getMainClassName
-
getStatementBlock
-