Class MockInstantiator
- All Implemented Interfaces:
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(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 Instantiatorcreate(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 Component>
TcreateComponent(Class<T> componentClass) Deprecated, for removal: This API element is subject to removal in a future version.Creates an instance of a component by itscomponentClass.<T extends HasElement>
TcreateRouteTarget(Class<T> routeTargetType, NavigationEvent event) Deprecated, for removal: This API element is subject to removal in a future version.Creates an instance of a navigation target or router layout.Class<?> getApplicationClass(Class<?> clazz) Deprecated, for removal: This API element is subject to removal in a future version.Return the application-defined class for the given class: usually simply the given class, but the original class in case of a runtime generated subclass.Class<?> getApplicationClass(Object instance) Deprecated, for removal: This API element is subject to removal in a future version.Return the application-defined class for the given instance: usually simply the class of the given instance, but the original class in case of a runtime generated subclass.Deprecated, for removal: This API element is subject to removal in a future version.Returns the instantiator every member of this class forwards to.getDependencyFilters(Stream<DependencyFilter> serviceInitFilters) Deprecated, for removal: This API element is subject to removal in a future version.Processes the available dependency filters.Deprecated, for removal: This API element is subject to removal in a future version.Get the I18NProvider if one has been defined.getIndexHtmlRequestListeners(Stream<IndexHtmlRequestListener> indexHtmlRequestListeners) Deprecated, for removal: This API element is subject to removal in a future version.Processes the available Index HTML request listeners.Deprecated, for removal: This API element is subject to removal in a future version.Get the MenuAccessControl.<T> TgetOrCreate(Class<T> type) Deprecated, for removal: This API element is subject to removal in a future version.Provides an instance of any given type, this is an abstraction that allows to make use of DI-frameworks from add-ons.Deprecated, for removal: This API element is subject to removal in a future version.Gets the application-wide defaultPageTitleGenerator, if one has been defined.Deprecated, for removal: This API element is subject to removal in a future version.Gets all service init listeners to use.
-
Constructor Details
-
MockInstantiator
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
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.Description copied from interface:InstantiatorProvides an instance of any given type, this is an abstraction that allows to make use of DI-frameworks from add-ons.How the object is created and whether it is being cached or not is up to the implementation.
- Specified by:
getOrCreatein interfaceInstantiator- Type Parameters:
T- the type of the instance to create- Parameters:
type- the instance type to create, notnull- Returns:
- an instance of the given type
-
getServiceInitListeners
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:InstantiatorGets all service init listeners to use. In addition to listeners defined in some way native to a specific instantiator, it is also recommended to support the defaultServiceLoaderconvention. This can be done by including the items fromDefaultInstantiator.getServiceInitListeners()in the returned stream.- Specified by:
getServiceInitListenersin interfaceInstantiator- Returns:
- stream of service init listeners, not
null
-
getIndexHtmlRequestListeners
public Stream<IndexHtmlRequestListener> getIndexHtmlRequestListeners(Stream<IndexHtmlRequestListener> indexHtmlRequestListeners) Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:InstantiatorProcesses the available Index HTML request listeners. This method can supplement the set of Index HTML request listeners provided byVaadinServiceInitListenerimplementations.The default implementation returns the original listeners without changes.
- Specified by:
getIndexHtmlRequestListenersin interfaceInstantiator- Parameters:
indexHtmlRequestListeners- a stream of Index HTML request listeners provided by service init listeners, notnull- Returns:
- a stream of all Index HTML request listeners to use, not
null
-
getDependencyFilters
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:InstantiatorProcesses the available dependency filters. This method can supplement the set of dependency filters provided byVaadinServiceInitListenerimplementations.The default implementation returns the original handlers without changes.
The order of the filters inside the stream defines the order of the execution of those listeners by the
UidlWriter.createUidl(UI, boolean)method.- Specified by:
getDependencyFiltersin interfaceInstantiator- Parameters:
serviceInitFilters- a stream of dependency filters provided by service init listeners, notnull- Returns:
- a stream of all dependency filters to use, not
null
-
getApplicationClass
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:InstantiatorReturn the application-defined class for the given instance: usually simply the class of the given instance, but the original class in case of a runtime generated subclass.- Specified by:
getApplicationClassin interfaceInstantiator- Parameters:
instance- the instance to check- Returns:
- the user-defined class
-
getApplicationClass
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:InstantiatorReturn the application-defined class for the given class: usually simply the given class, but the original class in case of a runtime generated subclass.- Specified by:
getApplicationClassin interfaceInstantiator- Parameters:
clazz- the class to check- Returns:
- the user-defined class
-
createComponent
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:InstantiatorCreates an instance of a component by itscomponentClass.- Specified by:
createComponentin interfaceInstantiator- Type Parameters:
T- the component type- Parameters:
componentClass- the instance type to create, notnull- Returns:
- the created instance, not
null
-
getI18NProvider
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:InstantiatorGet the I18NProvider if one has been defined.- Specified by:
getI18NProviderin interfaceInstantiator- Returns:
- I18NProvider instance
-
getMenuAccessControl
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:InstantiatorGet the MenuAccessControl.- Specified by:
getMenuAccessControlin interfaceInstantiator- Returns:
- MenuAccessControl instance
-
getPageTitleGenerator
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:InstantiatorGets the application-wide defaultPageTitleGenerator, if one has been defined.Used to resolve route titles without a per-route
DynamicPageTitle, for example a single generator that turns the declaredPageTitlevalue into a translated title for every route.- Specified by:
getPageTitleGeneratorin interfaceInstantiator- Returns:
- the default page title generator, or
nullif none has been defined
-
create
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
-