Class MockInstantiator
- All Implemented Interfaces:
com.vaadin.flow.di.Instantiator,Serializable
Instantiator wrapping the one the mocked environment provides.
The wrapper does not mock anything any more: the getOrCreate(java.lang.Class<T>) special
cases it was written for are long gone, so every member simply forwards to
delegate. The mocked services therefore use the environment's own
instantiator directly, and this class is kept for source compatibility only.
The forwarding is spelled out by hand on purpose. A wrapper that leaves a
method out inherits Flow's default implementation instead of reaching
the delegate, which is how a Spring PageTitleGenerator bean used to
be dropped in browserless tests. Since a wrapper can always fall behind a
method added to Instantiator later, create(Instantiator)
hands back the delegate itself instead of wrapping it.
The list of forwarders below is deliberately not guarded by a test: pinning
it would fail the build whenever Flow adds a method to Instantiator,
which is not worth it for a class scheduled for removal and used by nothing
here. A method missing from the list is therefore silently dropped for
callers who construct this class themselves — one more reason not to.
For internal use only. May be renamed or removed in a future release.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionMockInstantiator(com.vaadin.flow.di.Instantiator delegate) Deprecated, for removal: This API element is subject to removal in a future version.Creates a wrapper forwarding to the given instantiator. -
Method Summary
Modifier and TypeMethodDescriptionstatic com.vaadin.flow.di.Instantiatorcreate(com.vaadin.flow.di.Instantiator delegate) Deprecated, for removal: This API element is subject to removal in a future version.Returnsdelegateas is: wrapping it changes nothing, and a wrapper risks dropping methods added toInstantiatorin the future.<T extends com.vaadin.flow.component.Component>
TcreateComponent(Class<T> componentClass) Deprecated, for removal: This API element is subject to removal in a future version.<T extends com.vaadin.flow.component.HasElement>
TcreateRouteTarget(Class<T> routeTargetType, com.vaadin.flow.router.NavigationEvent event) Deprecated, for removal: This API element is subject to removal in a future version.Class<?> getApplicationClass(Class<?> clazz) Deprecated, for removal: This API element is subject to removal in a future version.Class<?> getApplicationClass(Object instance) Deprecated, for removal: This API element is subject to removal in a future version.com.vaadin.flow.di.InstantiatorDeprecated, for removal: This API element is subject to removal in a future version.Returns the instantiator every member of this class forwards to.Stream<com.vaadin.flow.server.DependencyFilter> getDependencyFilters(Stream<com.vaadin.flow.server.DependencyFilter> serviceInitFilters) Deprecated, for removal: This API element is subject to removal in a future version.com.vaadin.flow.i18n.I18NProviderDeprecated, for removal: This API element is subject to removal in a future version.Stream<com.vaadin.flow.server.communication.IndexHtmlRequestListener> getIndexHtmlRequestListeners(Stream<com.vaadin.flow.server.communication.IndexHtmlRequestListener> indexHtmlRequestListeners) Deprecated, for removal: This API element is subject to removal in a future version.com.vaadin.flow.server.auth.MenuAccessControlDeprecated, for removal: This API element is subject to removal in a future version.<T> TgetOrCreate(Class<T> type) Deprecated, for removal: This API element is subject to removal in a future version.com.vaadin.flow.router.PageTitleGeneratorDeprecated, for removal: This API element is subject to removal in a future version.Stream<com.vaadin.flow.server.VaadinServiceInitListener> Deprecated, for removal: This API element is subject to removal in a future version.
-
Constructor Details
-
MockInstantiator
public MockInstantiator(com.vaadin.flow.di.Instantiator delegate) Deprecated, for removal: This API element is subject to removal in a future version.Creates a wrapper forwarding to the given instantiator.- Parameters:
delegate- the instantiator to forward to
-
-
Method Details
-
getDelegate
public com.vaadin.flow.di.Instantiator getDelegate()Deprecated, for removal: This API element is subject to removal in a future version.Returns the instantiator every member of this class forwards to.- Returns:
- the delegate
-
getOrCreate
Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
getOrCreatein interfacecom.vaadin.flow.di.Instantiator
-
getServiceInitListeners
Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
getServiceInitListenersin interfacecom.vaadin.flow.di.Instantiator
-
getIndexHtmlRequestListeners
public Stream<com.vaadin.flow.server.communication.IndexHtmlRequestListener> getIndexHtmlRequestListeners(Stream<com.vaadin.flow.server.communication.IndexHtmlRequestListener> indexHtmlRequestListeners) Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
getIndexHtmlRequestListenersin interfacecom.vaadin.flow.di.Instantiator
-
getDependencyFilters
public Stream<com.vaadin.flow.server.DependencyFilter> getDependencyFilters(Stream<com.vaadin.flow.server.DependencyFilter> serviceInitFilters) Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
getDependencyFiltersin interfacecom.vaadin.flow.di.Instantiator
-
getApplicationClass
Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
getApplicationClassin interfacecom.vaadin.flow.di.Instantiator
-
getApplicationClass
Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
getApplicationClassin interfacecom.vaadin.flow.di.Instantiator
-
createComponent
Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
createComponentin interfacecom.vaadin.flow.di.Instantiator
-
getI18NProvider
public com.vaadin.flow.i18n.I18NProvider getI18NProvider()Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
getI18NProviderin interfacecom.vaadin.flow.di.Instantiator
-
getMenuAccessControl
public com.vaadin.flow.server.auth.MenuAccessControl getMenuAccessControl()Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
getMenuAccessControlin interfacecom.vaadin.flow.di.Instantiator
-
getPageTitleGenerator
public com.vaadin.flow.router.PageTitleGenerator getPageTitleGenerator()Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
getPageTitleGeneratorin interfacecom.vaadin.flow.di.Instantiator
-
create
public static com.vaadin.flow.di.Instantiator create(com.vaadin.flow.di.Instantiator delegate) Deprecated, for removal: This API element is subject to removal in a future version.Returnsdelegateas is: wrapping it changes nothing, and a wrapper risks dropping methods added toInstantiatorin the future.- Parameters:
delegate- the instantiator to return- Returns:
- the given instantiator, unwrapped
-