Package org.apache.commons.jci.compilers
Interface JavaCompiler
-
- All Known Implementing Classes:
AbstractJavaCompiler
,EclipseJavaCompiler
,GroovyJavaCompiler
,JaninoJavaCompiler
,RhinoJavaCompiler
public interface JavaCompiler
The general compiler interface. All compilers implementing this interface should read the resources from the reader and store the java class files into the ResourceStore. The actual compilation language does not matter. But the contract is that the result of the compilation will be a class file. If possible the compiler should notify the optional CompilationProblemHandler as soon as a problem is found.- Author:
- tcurdt
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description CompilationResult
compile(java.lang.String[] pResourcePaths, ResourceReader pReader, ResourceStore pStore)
uses the default compiler settings and the current classloaderCompilationResult
compile(java.lang.String[] pResourcePaths, ResourceReader pReader, ResourceStore pStore, java.lang.ClassLoader pClassLoader)
uses the default compiler settingsCompilationResult
compile(java.lang.String[] pResourcePaths, ResourceReader pReader, ResourceStore pStore, java.lang.ClassLoader pClassLoader, JavaCompilerSettings pSettings)
Compiles the java resources "some/path/to/MyJava.java" read through the ResourceReader and then stores the resulting classes in the ResourceStore under "some/path/to/MyJava.class".JavaCompilerSettings
createDefaultSettings()
factory method to create the underlying default settingsvoid
setCompilationProblemHandler(CompilationProblemHandler pHandler)
Set the the handler that gets the notification of an error or warning as soon as this information is available from the compiler.
-
-
-
Method Detail
-
setCompilationProblemHandler
void setCompilationProblemHandler(CompilationProblemHandler pHandler)
Set the the handler that gets the notification of an error or warning as soon as this information is available from the compiler. Note: Some compilers might not support this feature.- Parameters:
pHandler
-
-
createDefaultSettings
JavaCompilerSettings createDefaultSettings()
factory method to create the underlying default settings
-
compile
CompilationResult compile(java.lang.String[] pResourcePaths, ResourceReader pReader, ResourceStore pStore)
uses the default compiler settings and the current classloader
-
compile
CompilationResult compile(java.lang.String[] pResourcePaths, ResourceReader pReader, ResourceStore pStore, java.lang.ClassLoader pClassLoader)
uses the default compiler settings
-
compile
CompilationResult compile(java.lang.String[] pResourcePaths, ResourceReader pReader, ResourceStore pStore, java.lang.ClassLoader pClassLoader, JavaCompilerSettings pSettings)
Compiles the java resources "some/path/to/MyJava.java" read through the ResourceReader and then stores the resulting classes in the ResourceStore under "some/path/to/MyJava.class". Note: As these are resource path you always have to use "/" The result of the compilation run including detailed error information is returned as CompilationResult. If you need to get notified already during the compilation process you can register a CompilationProblemHandler. Note: Not all compilers might support this notification mechanism.- Parameters:
pResourcePaths
-pReader
-pStore
-pClassLoader
-pSettings
-- Returns:
- always a CompilationResult
-
-