Interface CompilerPlugin
A Compiler plugin provides a way to extend the Inverno compiler in order to process module beans or generate additional classes or resources during the compilation of a module.
A plugin is only executed once during the compilation of a module right before the module class is actually generated. If additional source files are generated during the execution of the plugin, the generation of the module class is postponed until the next round so that the Inverno compiler can integrate them.
- Since:
- 1.1
- Author:
- Jeremy Kuhn
-
Method Summary
Modifier and TypeMethodDescriptionbooleancanExecute(ModuleElement moduleElement)Determines whether the plugin can be executed for the specified module.voidexecute(PluginExecution execution)Executes the plugin.Returns the list of annotation types supported by the plugin.Returns the list of options supported by the plugin.voidinit(PluginContext pluginContext)Initializes the plugin with the specified context before execution.
-
Method Details
-
getSupportedAnnotationTypes
Returns the list of annotation types supported by the plugin.
Note that this list can be empty if the plugin is only interested in processing the module beans.
- Returns:
- a list of annotation types
-
getSupportedOptions
Returns the list of options supported by the plugin.
- Returns:
- a list of options
-
init
Initializes the plugin with the specified context before execution.
- Parameters:
pluginContext- the context used to initialize the plugin.
-
canExecute
Determines whether the plugin can be executed for the specified module.
A plugin might not execute for several reasons, in such cases this method must return false. For instance when a module required by a generated class or a module providing a supported annotation is not declared in the compiled module descriptor, the plugin can't execute.
- Parameters:
moduleElement- the module element- Returns:
- true if the plugin can be executed, false otherwise
-
execute
Executes the plugin.
- Parameters:
execution- the plugin execution- Throws:
PluginExecutionException- if something goes wrong during the execution
-