Class PythonAnnotationProcessor

All Implemented Interfaces:
AutoCloseable, Processor

@SupportedAnnotationTypes("io.micronaut.context.python.annotation.PythonApplication") public class PythonAnnotationProcessor extends AbstractInjectAnnotationProcessor implements AutoCloseable
Annotation processor for io.micronaut.context.python.annotation.PythonApplication that enables Python AST processing during Java compilation.
Since:
5.2.0
Author:
Micronaut
  • Field Details

  • Constructor Details

    • PythonAnnotationProcessor

      public PythonAnnotationProcessor()
  • Method Details

    • setClassElementCallback

      public void setClassElementCallback(Consumer<ClassElement> callback)
      Set the callback to be invoked for each class element created during processing. This is primarily used for testing purposes.
      Parameters:
      callback - The callback function
    • setPythonSourceVisitors

      public void setPythonSourceVisitors(List<PythonSourceVisitor> pythonSourceVisitors)
      Sets visitors for Python source metadata in this compilation.
      Parameters:
      pythonSourceVisitors - the visitors
    • setCompilePythonBytecode

      public void setCompilePythonBytecode(boolean compilePythonBytecode)
      Set whether generated Python VFS resources should include GraalPy bytecode caches.
      Parameters:
      compilePythonBytecode - Whether bytecode caches should be emitted
      Since:
      5.2.0
    • init

      public void init(ProcessingEnvironment processingEnv)
      Specified by:
      init in interface Processor
      Overrides:
      init in class AbstractInjectAnnotationProcessor
    • close

      public void close() throws Exception
      Specified by:
      close in interface AutoCloseable
      Throws:
      Exception
    • process

      public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv)
      Specified by:
      process in interface Processor
      Specified by:
      process in class AbstractProcessor
    • setClassLoader

      public void setClassLoader(ClassLoader classLoader)
      Sets the class loader used for in-memory compiler execution.
      Parameters:
      classLoader - The class loader