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 Summary
Modifier and TypeMethodDescriptionvoidcreateResourceFile(String path, Element[] originatingElements, Supplier<String> resource)Creates a resource file in the module.voidcreateSourceFile(String name, Element[] originatingElements, Supplier<String> source)Creates a source file in the module's source package (seeModule.sourcePackage().BeanInfo[]getBeans()Returns the module beans.Returns the program elements claimed by the plugin.getElementsAnnotatedWith(Class<? extends Annotation> a)Returns the program elements claimed by the plugin and annotated with the specified annotation.Returns the program elements claimed by the plugin and annotated with the specified annotation.Returns the element of the module being compiled.Returns the qualified name of the module being compiled.Returns the path to the module source directory.getReporter(Element element)Creates a reporter for the specified element.getReporter(Element element, AnnotationMirror annotation)Creates a reporter for the specified element and annotation.
-
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
Returns the program elements claimed by the plugin.
- Type Parameters:
T- the expected type of the elements.- Returns:
- a list of elements
-
getElementsAnnotatedWith
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
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
Creates a reporter for the specified element.
- Parameters:
element- the element- Returns:
- a new reporter
-
getReporter
Creates a reporter for the specified element and annotation.
- Parameters:
element- the elementannotation- the annotation- Returns:
- a new reporter
-
createSourceFile
void createSourceFile(String name, Element[] originatingElements, Supplier<String> source) throws IOExceptionCreates a source file in the module's source package (see
Module.sourcePackage().- Parameters:
name- the source file nameoriginatingElements- the originating elementssource- 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 IOExceptionCreates a resource file in the module.
- Parameters:
path- the path in the module where to create the fileoriginatingElements- the originating elementsresource- the resource content supplier- Throws:
IOException- If an I/O error occurs during the creation of the file
-
getModuleSourceDir
Returns the path to the module source directory.
- Returns:
- The path to the source directory
- Throws:
IOException- If an I/O error occurs
-