Interface JavaCompiler

  • All Known Implementing Classes:
    AbstractJavaCompiler, NativeJavaCompiler

    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.
    • Method Detail

      • createNativeCompiler

        static JavaCompiler createNativeCompiler()
      • createEclipseCompiler

        static JavaCompiler createEclipseCompiler()
      • createEclipseCompiler

        static JavaCompiler createEclipseCompiler​(String javaVersion)
      • setSourceFolder

        default void setSourceFolder​(String sourceFolder)
      • createDefaultSettings

        JavaCompilerSettings createDefaultSettings()
        factory method to create the underlying default settings
      • setJavaCompilerSettings

        void setJavaCompilerSettings​(JavaCompilerSettings javaCompilerSettings)
      • compile

        CompilationResult compile​(String[] pResourcePaths,
                                  ResourceReader pReader,
                                  ResourceStore pStore,
                                  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