public class ClassFileManager extends ForwardingJavaFileManager<JavaFileManager>
JavaFileManager.Location| Modifier and Type | Field and Description |
|---|---|
protected ScriptClassLoaderImpl |
loader
Classloader that will be used to load compiled classes
|
protected ScriptClassLoader |
parentClassLoader
Parent classloader for loader
|
fileManager| Constructor and Description |
|---|
ClassFileManager(JavaCompiler compiler,
DiagnosticListener<? super JavaFileObject> listener)
Creates new ClassFileManager.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addLibraries(Iterable<File> files)
Adds list of files as libraries.
|
void |
addLibrary(File file)
Adds library file.
|
ScriptClassLoaderImpl |
getClassLoader(JavaFileManager.Location location)
Returns classloaded of this ClassFileManager.
|
Map<String,BinaryClass> |
getCompiledClasses()
Returns list of classes that were compiled by compiler related to this
ClassFileManager
|
JavaFileObject |
getJavaFileForOutput(JavaFileManager.Location location,
String className,
JavaFileObject.Kind kind,
FileObject sibling)
Returns JavaFileObject that will be used to write class data into it by
compier
|
String |
inferBinaryName(JavaFileManager.Location location,
JavaFileObject file) |
Iterable<JavaFileObject> |
list(JavaFileManager.Location location,
String packageName,
Set<JavaFileObject.Kind> kinds,
boolean recurse)
This method overrides class resolving procedure for compiler.
|
void |
setParentClassLoader(ScriptClassLoader classLoader)
Sets paraentClassLoader for this classLoader
|
close, flush, getFileForInput, getFileForOutput, getJavaFileForInput, handleOption, hasLocation, isSameFile, isSupportedOptionprotected ScriptClassLoaderImpl loader
protected ScriptClassLoader parentClassLoader
public ClassFileManager(JavaCompiler compiler, DiagnosticListener<? super JavaFileObject> listener)
compiler - that will be usedlistener - class that will report compilation errorspublic JavaFileObject getJavaFileForOutput(JavaFileManager.Location location, String className, JavaFileObject.Kind kind, FileObject sibling) throws IOException
getJavaFileForOutput in interface JavaFileManagergetJavaFileForOutput in class ForwardingJavaFileManager<JavaFileManager>location - not usedclassName - JavaFileObject will have this classNamekind - not usedsibling - not usedIOException - never thrownpublic ScriptClassLoaderImpl getClassLoader(JavaFileManager.Location location)
getClassLoader in interface JavaFileManagergetClassLoader in class ForwardingJavaFileManager<JavaFileManager>location - not usedpublic void setParentClassLoader(ScriptClassLoader classLoader)
classLoader - parent class loaderpublic void addLibrary(File file) throws IOException
file - link to jar archieveIOException - if something goes wrongpublic void addLibraries(Iterable<File> files) throws IOException
files - list of jar archivesIOException - if something goes wrongpublic Map<String,BinaryClass> getCompiledClasses()
public Iterable<JavaFileObject> list(JavaFileManager.Location location, String packageName, Set<JavaFileObject.Kind> kinds, boolean recurse) throws IOException
list in interface JavaFileManagerlist in class ForwardingJavaFileManager<JavaFileManager>location - Location to search classespackageName - package to scan for classeskinds - FileTypes to searchrecurse - not usedIOException - if something foes wrongpublic String inferBinaryName(JavaFileManager.Location location, JavaFileObject file)
inferBinaryName in interface JavaFileManagerinferBinaryName in class ForwardingJavaFileManager<JavaFileManager>Copyright © 2014–2015. All rights reserved.