Package com.vaadin.cdi
Class CdiVaadinServletService.CdiVaadinServiceDelegate
java.lang.Object
com.vaadin.cdi.CdiVaadinServletService.CdiVaadinServiceDelegate
- All Implemented Interfaces:
Serializable
- Enclosing class:
CdiVaadinServletService
public static class CdiVaadinServletService.CdiVaadinServiceDelegate
extends Object
implements Serializable
This class implements the actual instantiation and event brokering
functionality of
CdiVaadinServletService.- Since:
- 11.2
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCdiVaadinServiceDelegate(jakarta.enterprise.inject.spi.BeanManager beanManager) Creates a new delegate using the given bean manager. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddUIListeners(com.vaadin.flow.component.UI ui) Adds listeners to the given UI that fire navigation, poll and detach events as CDI events.jakarta.enterprise.inject.spi.BeanManagerGets the bean manager, resolving it withBeanManagerProviderif it is not available, for example after deserialization.voidinit(com.vaadin.flow.server.VaadinService vaadinService) Initializes the given service: sets the CDI providedSystemMessagesProviderif available and registers the listeners that fire the corresponding CDI events.<T> Optional<T> Looks up aVaadinServiceEnabledCDI bean of the given type.
-
Constructor Details
-
CdiVaadinServiceDelegate
public CdiVaadinServiceDelegate(jakarta.enterprise.inject.spi.BeanManager beanManager) Creates a new delegate using the given bean manager.- Parameters:
beanManager- the bean manager used for looking up CDI beans- Since:
- 15.0.1
-
-
Method Details
-
init
public void init(com.vaadin.flow.server.VaadinService vaadinService) throws com.vaadin.flow.server.ServiceException Initializes the given service: sets the CDI providedSystemMessagesProviderif available and registers the listeners that fire the corresponding CDI events.- Parameters:
vaadinService- the service to initialize- Throws:
com.vaadin.flow.server.ServiceException- if multiple eligibleSystemMessagesProviderbeans are found- Since:
- 15.0.1
-
addUIListeners
public void addUIListeners(com.vaadin.flow.component.UI ui) Adds listeners to the given UI that fire navigation, poll and detach events as CDI events.- Parameters:
ui- the UI to add the listeners to
-
lookup
Looks up aVaadinServiceEnabledCDI bean of the given type.- Type Parameters:
T- the bean type- Parameters:
type- the bean type to look up- Returns:
- an optional containing the bean, or an empty optional if no such bean exists
- Throws:
com.vaadin.flow.server.ServiceException- if multiple eligible beans are found
-
getBeanManager
public jakarta.enterprise.inject.spi.BeanManager getBeanManager()Gets the bean manager, resolving it withBeanManagerProviderif it is not available, for example after deserialization.- Returns:
- the bean manager
-