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
 CompilationResult compile(String[] pResourcePaths, ResourceReader pReader, ResourceStore pStore)
          uses the default compiler settings and the current classloader
 CompilationResult compile(String[] pResourcePaths, ResourceReader pReader, ResourceStore pStore, ClassLoader pClassLoader)
          uses the default compiler settings
 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".
 JavaCompilerSettings createDefaultSettings()
          factory method to create the underlying default settings
 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.
 

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(String[] pResourcePaths,
                          ResourceReader pReader,
                          ResourceStore pStore)
uses the default compiler settings and the current classloader


compile

CompilationResult compile(String[] pResourcePaths,
                          ResourceReader pReader,
                          ResourceStore pStore,
                          ClassLoader pClassLoader)
uses the default compiler settings


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


Copyright © 2004–2013 The Apache Software Foundation. All rights reserved.