net.janino
Class Java.CompilationUnit
java.lang.Object
|
+--net.janino.Java.CompilationUnit
- All Implemented Interfaces:
- Java.Scope
- Enclosing class:
- Java
- public static class Java.CompilationUnit
- extends java.lang.Object
- implements Java.Scope
Holds the result of Parser.parseCompilationUnit()
.
A call to compile(IClassLoader, int)
generates an array of
ClassFile
objects which represent the classes and
interfaces defined in the compilation unit.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Java.CompilationUnit
public Java.CompilationUnit(java.lang.String optionalFileName)
- Parameters:
optionalFileName
- only for getFileName()
getFileName
public java.lang.String getFileName()
- Returns:
- the
optionalFileName
given at construction.
getEnclosingScope
public Java.Scope getEnclosingScope()
- Specified by:
getEnclosingScope
in interface Java.Scope
- Following copied from interface:
net.janino.Java.Scope
- Returns:
- Enclusing scope or "null".
setPackage
public void setPackage(java.lang.String packagE)
addImportedClass
public void addImportedClass(Scanner.Location location,
java.lang.String className,
java.lang.String fullClassName)
throws Parser.ParseException
addImportedPackage
public void addImportedPackage(java.lang.String packageName)
addClassOrInterfaceDeclaration
public void addClassOrInterfaceDeclaration(Java.ClassOrInterfaceDeclaration cid)
getClassOrInterfaceDeclarations
public Java.ClassOrInterfaceDeclaration[] getClassOrInterfaceDeclarations()
- Get all classes and interfaces declared in this compilation unit.
getClassOrInterfaceDeclaration
public Java.ClassOrInterfaceDeclaration getClassOrInterfaceDeclaration(java.lang.String className)
- Find one class or interface by name.
- Parameters:
className
- Fully qualified class name, e.g. "pkg1.pkg2.Outer$Inner".
compile
public ClassFile[] compile(IClassLoader iClassLoader,
int debuggingInformation)
throws Java.CompileException
- Compiles this compilation unit and returns a set of
ClassFile
objects.
- Parameters:
iClassLoader
- used to look for classes defined outside this compilation unit- Returns:
- a set of generated
ClassFile
objects