Interface PluginExecution


public interface PluginExecution

A plugin execution is provided during the execution of a CompilerPlugin and give access to the module beans and the program elements claimed by the plugin (see CompilerPlugin.getSupportedAnnotationTypes()).

It also allows to create source file or resource file.

Since:
1.1
Author:
Jeremy Kuhn
  • Method Details

    • getModuleElement

      ModuleElement getModuleElement()

      Returns the element of the module being compiled.

      Returns:
      a module element
    • getModuleQualifiedName

      ModuleQualifiedName getModuleQualifiedName()

      Returns the qualified name of the module being compiled.

      Returns:
      a module qualified name
    • getElements

      <T extends Element> Set<T> getElements()

      Returns the program elements claimed by the plugin.

      Type Parameters:
      T - the expected type of the elements.
      Returns:
      a list of elements
    • getElementsAnnotatedWith

      <T extends Element> Set<T> getElementsAnnotatedWith(Class<? extends Annotation> a)

      Returns the program elements claimed by the plugin and annotated with the specified annotation.

      Type Parameters:
      T - the expected type of the elements
      Parameters:
      a - The annotation type
      Returns:
      a list of elements
    • getElementsAnnotatedWith

      <T extends Element> Set<T> getElementsAnnotatedWith(TypeElement a)

      Returns the program elements claimed by the plugin and annotated with the specified annotation.

      Type Parameters:
      T - the expected type of the elements
      Parameters:
      a - The annotation type element
      Returns:
      a list of elements
    • getBeans

      BeanInfo[] getBeans()

      Returns the module beans.

      Note that this list doesn't include beans coming from source files generated by the Inverno compiler or plugins.

      Returns:
      a list of beans
    • getReporter

      ReporterInfo getReporter(Element element)

      Creates a reporter for the specified element.

      Parameters:
      element - the element
      Returns:
      a new reporter
    • getReporter

      ReporterInfo getReporter(Element element, AnnotationMirror annotation)

      Creates a reporter for the specified element and annotation.

      Parameters:
      element - the element
      annotation - the annotation
      Returns:
      a new reporter
    • createSourceFile

      void createSourceFile(String name, Element[] originatingElements, Supplier<String> source) throws IOException

      Creates a source file in the module's source package (see Module.sourcePackage().

      Parameters:
      name - the source file name
      originatingElements - the originating elements
      source - the source content supplier
      Throws:
      IOException - If an I/O error occurs during the creation of the file
    • createResourceFile

      void createResourceFile(String path, Element[] originatingElements, Supplier<String> resource) throws IOException

      Creates a resource file in the module.

      Parameters:
      path - the path in the module where to create the file
      originatingElements - the originating elements
      resource - the resource content supplier
      Throws:
      IOException - If an I/O error occurs during the creation of the file
    • getModuleSourceDir

      Path getModuleSourceDir() throws IOException

      Returns the path to the module source directory.

      Returns:
      The path to the source directory
      Throws:
      IOException - If an I/O error occurs