Class LookupInitializer
- All Implemented Interfaces:
AbstractLookupInitializer
- Direct Known Subclasses:
SpringLookupInitializer
AbstractLookupInitializer
.- Since:
- Author:
- Vaadin Ltd
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static class
Default implementation ofAppShellPredicate
.protected static class
Default implementation ofLookup
.protected static class
Default implementation ofResourceProvider
. -
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected Lookup
createLookup
(VaadinContext context, Map<Class<?>, Collection<Class<?>>> services) Creates a lookup based on providedservices
.protected <T> void
ensureService
(Map<Class<?>, Collection<Class<?>>> services, Class<T> serviceType, Class<? extends T> serviceImpl) Ensures that providedservices
contain implementation forserviceType
SPI.Returns the default implementation classes included.void
initialize
(VaadinContext context, Map<Class<?>, Collection<Class<?>>> services, VaadinApplicationInitializationBootstrap bootstrap) Creates a newLookup
instance, initializes it and passes it to the providedbootstrap
.protected <T> T
instantiate
(Class<T> serviceClass, Class<?> implementation) Instantiates serviceimplementation
type with the givenserviceClass
.
-
Field Details
-
SPI
- See Also:
-
ONE_IMPL_REQUIRED
- See Also:
-
SEVERAL_IMPLS
- See Also:
-
-
Constructor Details
-
LookupInitializer
public LookupInitializer()
-
-
Method Details
-
initialize
public void initialize(VaadinContext context, Map<Class<?>, Collection<Class<?>>> services, VaadinApplicationInitializationBootstrap bootstrap) throws jakarta.servlet.ServletExceptionDescription copied from interface:AbstractLookupInitializer
Creates a newLookup
instance, initializes it and passes it to the providedbootstrap
.The method should creates a new initialized
Lookup
instance. In some cases it's not possible to create the instance right away when the method is called. To be able to support this usecase the method contract doesn't require to return theLookup
instance. Instead the created instance should be passed to the providedbootstrap
consumer once the instance is created and completely initialized. Thebootstrap
will start the application initialization which otherwise is postponed until aLookup
becomes available.The implementation must use the provided
bootstrap
to pass theLookup
instance otherwise the web application based on thisLookupInitializer
will never be bootstrapped.The provided
services
map contains service implementations found in application classpath using@HandlesTypes
annotation declared forLookupServletContainerInitializer
.- Specified by:
initialize
in interfaceAbstractLookupInitializer
- Parameters:
context
- a Vaadin context to run initialization forservices
- the map of internal services with their implementations found in the application classpathbootstrap
- the web application bootstrap- Throws:
jakarta.servlet.ServletException
- if initialization failed
-
createLookup
Creates a lookup based on providedservices
.- Parameters:
context
- a Vaadin context to create a lookup forservices
- the service objects mapped to the service type to create a lookup- Returns:
- the lookup instance created with provided services
-
ensureService
protected <T> void ensureService(Map<Class<?>, Collection<Class<?>>> services, Class<T> serviceType, Class<? extends T> serviceImpl) Ensures that providedservices
contain implementation forserviceType
SPI.The default
serviceImpl
implementation will be set as the service intoservices
if there is no other services available.- Parameters:
services
- map of internal servicesserviceType
- SPI typeserviceImpl
- the default SPI implementation
-
instantiate
Instantiates serviceimplementation
type with the givenserviceClass
.- Type Parameters:
T
- service type- Parameters:
serviceClass
- service classimplementation
- service implementation class- Returns:
- an instantiated service implementation object
-
getDefaultImplementations
Returns the default implementation classes included.This method is public only for internal purposes.
- Returns:
- a set of classes
-