Class ProcessorOptionsSystemProperties
java.lang.Object
io.micronaut.inject.visitor.util.ProcessorOptionsSystemProperties
Exposes the Micronaut processor options of a compilation as system properties, for the visitors
that read them from there (in particular micronaut-openapi), and restores the previous values once
the compilation is over.
The properties are applied when a processor is initialized, and restored when the last processor
that acquired them releases them at the end of
processing. Without that, in a long-lived JVM (a Gradle daemon, a test suite, an IDE) the options of
one compilation would be seen by every later compilation.
A processor that is initialized but never asked to process anything never acquires the properties, so it does not hold them. When a compilation applies its options while nothing holds the properties of a previous compilation, those are restored first.
- Since:
- 5.2.16
- Author:
- Denis Stepanov
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidMarks the properties as used by the given processor until itreleasesthem.static voidSets the Micronaut options of a compilation as system properties.static booleanprocess(Object processor, boolean processingOver, BooleanSupplier round) Runs a processing round of the given processor while it holds the properties, and releases them after the last round.static voidReleases the properties acquired by the given processor, restoring the previous values when no other processor holds them.
-
Method Details
-
apply
-
acquire
-
process
Runs a processing round of the given processor while it holds the properties, and releases them after the last round.- Parameters:
processor- The processorprocessingOver- Whether this is the last roundround- The processing of the round- Returns:
- The result of the round
-
release
Releases the properties acquired by the given processor, restoring the previous values when no other processor holds them.- Parameters:
processor- The processor
-