
jakarta.enterprise.inject.build.compatible.spi.BuildCompatibleExtension Maven / Gradle / Ivy
package jakarta.enterprise.inject.build.compatible.spi;
/**
* Build compatible extensions are service providers for this interface, as defined in {@link java.util.ServiceLoader}.
* This means: they are classes that implement this interface, provide a {@code META-INF/services} file,
* and satisfy all other service provider constraints. Additionally, extensions should not be CDI beans
* and should not be used at application runtime.
*
* Extensions can define arbitrary {@code public}, non-{@code static}, {@code void}-returning methods
* without type parameters, annotated with one of the extension annotations.
*
* Extension processing occurs in 4 phases, corresponding to 4 extension annotations:
*
* - {@link Discovery @Discovery}
* - {@link Enhancement @Enhancement}
* - {@link Synthesis @Synthesis}
* - {@link Validation @Validation}
*
*
* These methods can declare arbitrary number of parameters. Which parameters can be declared depends
* on the particular processing phase and is documented in the corresponding extension annotation.
* All the parameters will be provided by the container when the extension is invoked.
*
* Extension methods can be assigned a priority using {@link jakarta.enterprise.inject.build.compatible.spi.ExtensionPriority @ExtensionPriority}.
* Note that priority only affects order of extensions in a single phase.
*
* If the extension declares multiple methods, they are all invoked on the same instance of the class.
*
* Extension classes can be annotated {@link SkipIfPortableExtensionPresent @SkipIfPortablExtensionPresent}
* when they are supposed to be ignored in presence of a given portable extension.
*/
public interface BuildCompatibleExtension {
// TODO rename? "build compatible" is too long; ideally, we'd have a single word that describes
// the true nature of the "new" extension API (which IMHO is: there's a barrier between extension execution
// and application execution, there's only a very narrow way how to pass information from extension
// to application, and there's _no way whatsoever_ to pass anything in the other direction)
}