jakarta.enterprise.inject.build.compatible.spi.SyntheticComponents Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jakarta.enterprise.cdi-api Show documentation
Show all versions of jakarta.enterprise.cdi-api Show documentation
APIs for CDI (Contexts and Dependency Injection for Java)
package jakarta.enterprise.inject.build.compatible.spi;
import jakarta.enterprise.lang.model.types.Type;
/**
* Allows registering synthetic beans and observers.
*
* @since 4.0
*/
public interface SyntheticComponents {
/**
* Creates a {@link SyntheticBeanBuilder} that allows configuring a new synthetic bean
* of given {@code beanClass}. The synthetic bean will be registered at the end of
* the {@link Synthesis @Synthesis} method.
*
* @param beanClass the bean class of the new synthetic bean, must not be {@code null}
* @param the bean class of the new synthetic bean
* @return a new {@link SyntheticBeanBuilder}, never {@code null}
*/
SyntheticBeanBuilder addBean(Class beanClass);
/**
* Creates a {@link SyntheticObserverBuilder} that allows configuring a new synthetic observer
* for given {@code eventType}. The synthetic observer will be registered at the end of
* the {@link Synthesis @Synthesis} method.
*
* @param eventType the observed event type of the new synthetic observer, must not be {@code null}
* @param the observed event type of the new synthetic observer
* @return a new {@link SyntheticObserverBuilder}, never {@code null}
*/
SyntheticObserverBuilder addObserver(Class eventType);
/**
* Creates a {@link SyntheticObserverBuilder} that allows configuring a new synthetic observer
* for given {@code eventType}. The synthetic observer will be registered at the end of
* the {@link Synthesis @Synthesis} method.
*
* This method is supposed to be called with explicitly provided type arguments. For example,
* to define a synthetic observer of event type {@code List}, one would call:
* {@code
* // types is of type Types
* // syntheticComponents is of type SyntheticComponents
* syntheticComponents.>addObserver(types.parameterized(List.class, String.class))
* ...
* }
*
* @param eventType the observed event type of the new synthetic observer, must not be {@code null}
* @param the observed event type of the new synthetic observer
* @return a new {@link SyntheticObserverBuilder}, never {@code null}
*/
SyntheticObserverBuilder addObserver(Type eventType);
}