Module jakarta.cdi
Interface SyntheticComponents
-
public interface SyntheticComponents
Allows registering synthetic beans and observers.- Since:
- 4.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T> SyntheticBeanBuilder<T>
addBean(java.lang.Class<T> implementationClass)
Creates aSyntheticBeanBuilder
that allows configuring a new synthetic bean of givenimplementationClass
.<T> SyntheticObserverBuilder<T>
addObserver(Type eventType)
Creates aSyntheticObserverBuilder
that allows configuring a new synthetic observer for giveneventType
.<T> SyntheticObserverBuilder<T>
addObserver(java.lang.Class<T> eventType)
Creates aSyntheticObserverBuilder
that allows configuring a new synthetic observer for giveneventType
.
-
-
-
Method Detail
-
addBean
<T> SyntheticBeanBuilder<T> addBean(java.lang.Class<T> implementationClass)
Creates aSyntheticBeanBuilder
that allows configuring a new synthetic bean of givenimplementationClass
. The synthetic bean will be registered at the end of the@Synthesis
method.- Type Parameters:
T
- the implementation class of the new synthetic bean- Parameters:
implementationClass
- the implementation class of the new synthetic bean, must not benull
- Returns:
- a new
SyntheticBeanBuilder
, nevernull
-
addObserver
<T> SyntheticObserverBuilder<T> addObserver(java.lang.Class<T> eventType)
Creates aSyntheticObserverBuilder
that allows configuring a new synthetic observer for giveneventType
. The synthetic observer will be registered at the end of the@Synthesis
method.- Type Parameters:
T
- the observed event type of the new synthetic observer- Parameters:
eventType
- the observed event type of the new synthetic observer, must not benull
- Returns:
- a new
SyntheticObserverBuilder
, nevernull
-
addObserver
<T> SyntheticObserverBuilder<T> addObserver(Type eventType)
Creates aSyntheticObserverBuilder
that allows configuring a new synthetic observer for giveneventType
. The synthetic observer will be registered at the end of the@Synthesis
method.This method is supposed to be called with explicitly provided type arguments. For example, to define a synthetic observer of event type
List<String>
, one would call:// types is of type Types // syntheticComponents is of type SyntheticComponents syntheticComponents.<List<String>>addObserver(types.parameterized(List.class, String.class)) ...
- Type Parameters:
T
- the observed event type of the new synthetic observer- Parameters:
eventType
- the observed event type of the new synthetic observer, must not benull
- Returns:
- a new
SyntheticObserverBuilder
, nevernull
-
-