Class GroovyCompiler
java.lang.Object
org.springframework.boot.cli.compiler.GroovyCompiler
Compiler for Groovy sources. Primarily a simple Facade for
GroovyClassLoader.parseClass(GroovyCodeSource) with the following additional
features:
CompilerAutoConfigurationstrategies will be read fromMETA-INF/services/org.springframework.boot.cli.compiler.CompilerAutoConfiguration(per the standard javaServiceLoadercontract) and applied during compilation- Multiple classes can be returned if the Groovy source defines more than one Class
- Generated class files can also be loaded using
ClassLoader.getResource(String)
- Since:
- 1.0.0
- Author:
- Phillip Webb, Dave Syer, Andy Wilkinson
-
Constructor Summary
ConstructorsConstructorDescriptionGroovyCompiler(GroovyCompilerConfiguration configuration) Create a newGroovyCompilerinstance. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCompilationCustomizers(org.codehaus.groovy.control.customizers.CompilationCustomizer... customizers) Class<?>[]Compile the specified Groovy sources, applying anyCompilerAutoConfigurations.List<org.codehaus.groovy.transform.ASTTransformation>Return a mutable list of theASTTransformations to be applied duringcompile(String...).
-
Constructor Details
-
GroovyCompiler
Create a newGroovyCompilerinstance.- Parameters:
configuration- the compiler configuration
-
-
Method Details
-
getAstTransformations
Return a mutable list of theASTTransformations to be applied duringcompile(String...).- Returns:
- the AST transformations to apply
-
getLoader
-
addCompilationCustomizers
public void addCompilationCustomizers(org.codehaus.groovy.control.customizers.CompilationCustomizer... customizers) -
compile
public Class<?>[] compile(String... sources) throws org.codehaus.groovy.control.CompilationFailedException, IOException Compile the specified Groovy sources, applying anyCompilerAutoConfigurations. All classes defined in the sources will be returned from this method.- Parameters:
sources- the sources to compile- Returns:
- compiled classes
- Throws:
org.codehaus.groovy.control.CompilationFailedException- in case of compilation failuresIOException- in case of I/O errorsorg.codehaus.groovy.control.CompilationFailedException- in case of compilation errors
-