Class MockInstantiator
-
- All Implemented Interfaces:
-
com.vaadin.flow.di.Instantiator,java.io.Serializable
@Deprecated(message = "Wrapping the instantiator of the mocked environment has no effect; use that instantiator directly. Scheduled for removal.") public class MockInstantiator implements Instantiator
An Instantiator wrapping the one the mocked environment provides.
The wrapper does not mock anything any more: the getOrCreate 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: Kotlin interface delegation only generates forwarders for the abstract members of Instantiator, so a method Flow declares as a Java
defaultwould otherwise resolve to that default implementation and never reach the delegate — which is how a SpringPageTitleGeneratorbean used to be dropped in browserless tests. Since a wrapper can always fall behind a method added to Instantiator later, create 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.
-
-
Field Summary
Fields Modifier and Type Field Description private final Instantiatordelegateprivate final PageTitleGeneratorpageTitleGeneratorprivate final I18NProvideri18NProviderprivate final Stream<VaadinServiceInitListener>serviceInitListenersprivate final MenuAccessControlmenuAccessControl
-
Constructor Summary
Constructors Constructor Description MockInstantiator(Instantiator delegate)
-
Method Summary
Modifier and Type Method Description final InstantiatorgetDelegate()<T extends Any> TgetOrCreate(Class<T> type)MenuAccessControlgetMenuAccessControl()I18NProvidergetI18NProvider()PageTitleGeneratorgetPageTitleGenerator()Stream<IndexHtmlRequestListener>getIndexHtmlRequestListeners(Stream<IndexHtmlRequestListener> indexHtmlRequestListeners)Stream<DependencyFilter>getDependencyFilters(Stream<DependencyFilter> serviceInitFilters)Class<?>getApplicationClass(Object instance)Class<?>getApplicationClass(Class<?> clazz)<T extends HasElement> TcreateRouteTarget(Class<T> routeTargetType, NavigationEvent event)final static Instantiatorcreate(Instantiator delegate)Returns delegate as is: wrapping it changes nothing, and a wrapper risks dropping methods added to Instantiator in the future. -
Methods inherited from class com.vaadin.browserless.mocks.MockInstantiator
getI18NProvider, getMenuAccessControl, getPageTitleGenerator, getServiceInitListeners -
Methods inherited from class com.vaadin.flow.di.Instantiator
createComponent, getServiceInitListeners -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
getDelegate
final Instantiator getDelegate()
-
getOrCreate
<T extends Any> T getOrCreate(Class<T> type)
-
getMenuAccessControl
MenuAccessControl getMenuAccessControl()
-
getI18NProvider
I18NProvider getI18NProvider()
-
getPageTitleGenerator
PageTitleGenerator getPageTitleGenerator()
-
getIndexHtmlRequestListeners
Stream<IndexHtmlRequestListener> getIndexHtmlRequestListeners(Stream<IndexHtmlRequestListener> indexHtmlRequestListeners)
-
getDependencyFilters
Stream<DependencyFilter> getDependencyFilters(Stream<DependencyFilter> serviceInitFilters)
-
getApplicationClass
Class<?> getApplicationClass(Object instance)
-
getApplicationClass
Class<?> getApplicationClass(Class<?> clazz)
-
createRouteTarget
<T extends HasElement> T createRouteTarget(Class<T> routeTargetType, NavigationEvent event)
-
-
-
-