类 GroovyCompiler
- java.lang.Object
- org.springframework.boot.cli.compiler.GroovyCompiler
public class GroovyCompiler extends Object
Compiler for Groovy sources. Primarily a simple Facade forGroovyClassLoader.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)
构造器概要
构造器 构造器 说明 GroovyCompiler(GroovyCompilerConfiguration configuration)Create a newGroovyCompilerinstance.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 voidaddCompilationCustomizers(org.codehaus.groovy.control.customizers.CompilationCustomizer... customizers)Class<?>[]compile(String... sources)Compile the specified Groovy sources, applying anyCompilerAutoConfigurations.List<org.codehaus.groovy.transform.ASTTransformation>getAstTransformations()Return a mutable list of theASTTransformations to be applied duringcompile(String...).ExtendedGroovyClassLoadergetLoader()
构造器详细资料
GroovyCompiler
public GroovyCompiler(GroovyCompilerConfiguration configuration)
Create a newGroovyCompilerinstance.- 参数:
configuration- the compiler configuration
方法详细资料
getAstTransformations
public List<org.codehaus.groovy.transform.ASTTransformation> getAstTransformations()
Return a mutable list of theASTTransformations to be applied duringcompile(String...).- 返回:
- the AST transformations to apply
getLoader
public ExtendedGroovyClassLoader 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.- 参数:
sources- the sources to compile- 返回:
- compiled classes
- 抛出:
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