public class VolatileCompiler extends Object implements Closeable
VolatileJavaFile
,
VolatileResourceFile
,
VolatileClassFile
Constructor and Description |
---|
VolatileCompiler()
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
VolatileCompiler |
addArguments(String... compilerArguments)
Adds compiler arguments.
|
VolatileCompiler |
addProcessor(Processor processor)
Adds an annotation processor.
|
VolatileCompiler |
addSource(JavaFileObject java)
Adds a Java source program.
|
void |
close() |
List<Diagnostic<? extends JavaFileObject>> |
doCompile()
Compiles the
#addSource(JavaFileObject) added source files and returns its diagnostics objects. |
ClassLoader |
getClassLoader()
Returns the class loader which provides compiled classes by the compiler.
|
Collection<VolatileClassFile> |
getCompiled()
Returns the class files which are generated by this compiler.
|
Collection<VolatileResourceFile> |
getResources()
Returns the resource files which are generated by this compiler.
|
Collection<VolatileJavaFile> |
getSources()
Returns the Java source files which are generated by this compiler.
|
VolatileCompiler |
resetArguments()
Clears the
registered compiler arguments . |
public VolatileCompiler()
IllegalStateException
- if the Java compiler is not availablepublic VolatileCompiler addSource(JavaFileObject java)
java
- the target source fileIllegalArgumentException
- if the parameter is null
public VolatileCompiler addProcessor(Processor processor)
processor
- the target annotation processorIllegalArgumentException
- if the parameter is null
public VolatileCompiler resetArguments()
registered compiler arguments
.
Note that, this also removes preset following compiler arguments:
-source
-target
-encoding
public VolatileCompiler addArguments(String... compilerArguments)
-source 1.8
-target 1.8
-encoding UTF-8
compilerArguments
- the compiler arguments to addIllegalArgumentException
- if the parameter is null
resetArguments()
public List<Diagnostic<? extends JavaFileObject>> doCompile()
#addSource(JavaFileObject) added source files
and returns its diagnostics objects.public ClassLoader getClassLoader()
public Collection<VolatileJavaFile> getSources()
public Collection<VolatileResourceFile> getResources()
public Collection<VolatileClassFile> getCompiled()
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
Copyright © 2011–2019 Asakusa Framework Team. All rights reserved.