Package org.kie.memorycompiler
Interface JavaCompiler
-
- All Known Implementing Classes:
AbstractJavaCompiler,NativeJavaCompiler
public interface JavaCompilerThe 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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classJavaCompiler.CompilerHolder
-
Field Summary
Fields Modifier and Type Field Description static booleanDUMP_GENERATED_CLASSES
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description CompilationResultcompile(java.lang.String[] pResourcePaths, ResourceReader pReader, ResourceStore pStore)uses the default compiler settings and the current classloaderCompilationResultcompile(java.lang.String[] pResourcePaths, ResourceReader pReader, ResourceStore pStore, java.lang.ClassLoader pClassLoader)uses the default compiler settingsCompilationResultcompile(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".JavaCompilerSettingscreateDefaultSettings()factory method to create the underlying default settingsstatic JavaCompilercreateEclipseCompiler()static JavaCompilercreateEclipseCompiler(java.lang.String javaVersion)static JavaCompilercreateNativeCompiler()static JavaCompilercreateNativeCompiler(java.lang.String javaVersion)static JavaCompilergetCompiler()voidsetJavaCompilerSettings(JavaCompilerSettings javaCompilerSettings)default voidsetSourceFolder(java.lang.String sourceFolder)
-
-
-
Field Detail
-
DUMP_GENERATED_CLASSES
static final boolean DUMP_GENERATED_CLASSES
- See Also:
- Constant Field Values
-
-
Method Detail
-
getCompiler
static JavaCompiler getCompiler()
-
createNativeCompiler
static JavaCompiler createNativeCompiler()
-
createNativeCompiler
static JavaCompiler createNativeCompiler(java.lang.String javaVersion)
-
createEclipseCompiler
static JavaCompiler createEclipseCompiler()
-
createEclipseCompiler
static JavaCompiler createEclipseCompiler(java.lang.String javaVersion)
-
setSourceFolder
default void setSourceFolder(java.lang.String sourceFolder)
-
createDefaultSettings
JavaCompilerSettings createDefaultSettings()
factory method to create the underlying default settings
-
setJavaCompilerSettings
void setJavaCompilerSettings(JavaCompilerSettings javaCompilerSettings)
-
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
-
-