Package org.codehaus.groovy.ast
Class CompileUnit
- java.lang.Object
- 
- org.codehaus.groovy.ast.CompileUnit
 
- 
- All Implemented Interfaces:
- NodeMetaDataHandler
 
 public class CompileUnit extends Object implements NodeMetaDataHandler Represents the entire contents of a compilation step which consists of one or moreModuleNodeinstances. There's one instance of this that's shared by all modules and classes compiled during a single invocation of the compiler.It's attached to MethodNodes and ClassNodes and is used to find fully qualified names of classes, resolve imports, and that sort of thing. 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classCompileUnit.ConstructedOuterNestedClassNodeRepresents a resolved type as a placeholder.
 - 
Constructor SummaryConstructors Constructor Description CompileUnit(GroovyClassLoader classLoader, CodeSource codeSource, CompilerConfiguration config)CompileUnit(GroovyClassLoader classLoader, CompilerConfiguration config)
 - 
Method Summary- 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface org.codehaus.groovy.ast.NodeMetaDataHandlercopyNodeMetaData, getNodeMetaData, getNodeMetaData, getNodeMetaData, putNodeMetaData, removeNodeMetaData, setNodeMetaData
 
- 
 
- 
- 
- 
Constructor Detail- 
CompileUnitpublic CompileUnit(GroovyClassLoader classLoader, CompilerConfiguration config) 
 - 
CompileUnitpublic CompileUnit(GroovyClassLoader classLoader, CodeSource codeSource, CompilerConfiguration config) 
 
- 
 - 
Method Detail- 
getModulespublic List<ModuleNode> getModules() 
 - 
addModulepublic void addModule(ModuleNode node) 
 - 
getClasspublic ClassNode getClass(String name) - Returns:
- the ClassNode for the given qualified name or returns null if the name does not exist in the current compilation unit (ignoring the .class files on the classpath)
 
 - 
getClassespublic List<ClassNode> getClasses() - Returns:
- a list of all the classes in each module in the compilation unit
 
 - 
getConfigpublic CompilerConfiguration getConfig() 
 - 
getClassLoaderpublic GroovyClassLoader getClassLoader() 
 - 
getCodeSourcepublic CodeSource getCodeSource() 
 - 
addClasspublic void addClass(ClassNode node) Adds a class to the unit.
 - 
addClassNodeToCompilepublic void addClassNodeToCompile(ClassNode node, SourceUnit location) this method actually does not compile a class. It's only a marker that this type has to be compiled by the CompilationUnit at the end of a parse step no node should be be left.
 - 
getScriptSourceLocationpublic SourceUnit getScriptSourceLocation(String className) 
 - 
hasClassNodeToCompilepublic boolean hasClassNodeToCompile() 
 - 
getGeneratedInnerClasspublic InnerClassNode getGeneratedInnerClass(String name) 
 - 
addGeneratedInnerClasspublic void addGeneratedInnerClass(InnerClassNode icn) 
 - 
getGeneratedInnerClassespublic Map<String,InnerClassNode> getGeneratedInnerClasses() 
 - 
getClassesToResolvepublic Map<String,CompileUnit.ConstructedOuterNestedClassNode> getClassesToResolve() 
 - 
addClassNodeToResolvepublic void addClassNodeToResolve(CompileUnit.ConstructedOuterNestedClassNode cn) Add a constructed class node as a placeholder to resolve outer nested class further.- Parameters:
- cn- the constructed class node
 
 - 
getMetaDataMappublic Map<?,?> getMetaDataMap() - Specified by:
- getMetaDataMapin interface- NodeMetaDataHandler
 
 - 
setMetaDataMappublic void setMetaDataMap(Map<?,?> metaDataMap) - Specified by:
- setMetaDataMapin interface- NodeMetaDataHandler
 
 
- 
 
-