Class CompilerAutoConfiguration

java.lang.Object
org.springframework.boot.cli.compiler.CompilerAutoConfiguration
Direct Known Subclasses:
CachingCompilerAutoConfiguration, GroovyTemplatesCompilerAutoConfiguration, JdbcCompilerAutoConfiguration, JmsCompilerAutoConfiguration, RabbitCompilerAutoConfiguration, SpringBatchCompilerAutoConfiguration, SpringBootCompilerAutoConfiguration, SpringIntegrationCompilerAutoConfiguration, SpringMvcCompilerAutoConfiguration, SpringRetryCompilerAutoConfiguration, SpringSecurityCompilerAutoConfiguration, SpringTestCompilerAutoConfiguration, SpringWebsocketCompilerAutoConfiguration, TransactionManagementCompilerAutoConfiguration

public abstract class CompilerAutoConfiguration extends Object
Strategy that can be used to apply some auto-configuration during the CompilePhase.CONVERSION Groovy compile phase.
Since:
1.0.0
Author:
Phillip Webb
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    apply(groovy.lang.GroovyClassLoader loader, GroovyCompilerConfiguration configuration, org.codehaus.groovy.classgen.GeneratorContext generatorContext, org.codehaus.groovy.control.SourceUnit source, org.codehaus.groovy.ast.ClassNode classNode)
    Apply any additional configuration.
    void
    Apply any dependency customizations.
    void
    applyImports(org.codehaus.groovy.control.customizers.ImportCustomizer imports)
    Apply any import customizations.
    void
    applyToMainClass(groovy.lang.GroovyClassLoader loader, GroovyCompilerConfiguration configuration, org.codehaus.groovy.classgen.GeneratorContext generatorContext, org.codehaus.groovy.control.SourceUnit source, org.codehaus.groovy.ast.ClassNode classNode)
    Apply any customizations to the main class.
    boolean
    matches(org.codehaus.groovy.ast.ClassNode classNode)
    Strategy method used to determine when compiler auto-configuration should be applied.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • CompilerAutoConfiguration

      public CompilerAutoConfiguration()
  • Method Details

    • matches

      public boolean matches(org.codehaus.groovy.ast.ClassNode classNode)
      Strategy method used to determine when compiler auto-configuration should be applied. Defaults to always.
      Parameters:
      classNode - the class node
      Returns:
      true if the compiler should be auto configured using this class. If this method returns false no other strategy methods will be called.
    • applyDependencies

      public void applyDependencies(DependencyCustomizer dependencies) throws org.codehaus.groovy.control.CompilationFailedException
      Apply any dependency customizations. This method will only be called if matches(org.codehaus.groovy.ast.ClassNode) returns true.
      Parameters:
      dependencies - dependency customizer
      Throws:
      org.codehaus.groovy.control.CompilationFailedException - if the dependencies cannot be applied
    • applyImports

      public void applyImports(org.codehaus.groovy.control.customizers.ImportCustomizer imports) throws org.codehaus.groovy.control.CompilationFailedException
      Apply any import customizations. This method will only be called if matches(org.codehaus.groovy.ast.ClassNode) returns true.
      Parameters:
      imports - import customizer
      Throws:
      org.codehaus.groovy.control.CompilationFailedException - if the imports cannot be applied
    • applyToMainClass

      public void applyToMainClass(groovy.lang.GroovyClassLoader loader, GroovyCompilerConfiguration configuration, org.codehaus.groovy.classgen.GeneratorContext generatorContext, org.codehaus.groovy.control.SourceUnit source, org.codehaus.groovy.ast.ClassNode classNode) throws org.codehaus.groovy.control.CompilationFailedException
      Apply any customizations to the main class. This method will only be called if matches(org.codehaus.groovy.ast.ClassNode) returns true. This method is useful when a groovy file defines more than one class but customization only applies to the first class.
      Parameters:
      loader - the class loader being used during compilation
      configuration - the compiler configuration
      generatorContext - the current context
      source - the source unit
      classNode - the main class
      Throws:
      org.codehaus.groovy.control.CompilationFailedException - if the customizations cannot be applied
    • apply

      public void apply(groovy.lang.GroovyClassLoader loader, GroovyCompilerConfiguration configuration, org.codehaus.groovy.classgen.GeneratorContext generatorContext, org.codehaus.groovy.control.SourceUnit source, org.codehaus.groovy.ast.ClassNode classNode) throws org.codehaus.groovy.control.CompilationFailedException
      Apply any additional configuration.
      Parameters:
      loader - the class loader being used during compilation
      configuration - the compiler configuration
      generatorContext - the current context
      source - the source unit
      classNode - the class
      Throws:
      org.codehaus.groovy.control.CompilationFailedException - if the configuration cannot be applied