Class MockInstantiator

java.lang.Object
com.vaadin.browserless.mocks.MockInstantiator
All Implemented Interfaces:
com.vaadin.flow.di.Instantiator, Serializable

@Deprecated(forRemoval=true) public class MockInstantiator extends Object implements com.vaadin.flow.di.Instantiator
Deprecated, for removal: This API element is subject to removal in a future version.
Wrapping the instantiator of the mocked environment has no effect; use that instantiator directly. Scheduled for removal.
An 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

    Constructors
    Constructor
    Description
    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.
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
    Returns delegate as is: wrapping it changes nothing, and a wrapper risks dropping methods added to Instantiator in the future.
    <T extends com.vaadin.flow.component.Component>
    T
    createComponent(Class<T> componentClass)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    <T extends com.vaadin.flow.component.HasElement>
    T
    createRouteTarget(Class<T> routeTargetType, com.vaadin.flow.router.NavigationEvent event)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    com.vaadin.flow.di.Instantiator
    Deprecated, 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.I18NProvider
    Deprecated, 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.MenuAccessControl
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    <T> T
    getOrCreate(Class<T> type)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    com.vaadin.flow.router.PageTitleGenerator
    Deprecated, 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.
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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

      public <T> T getOrCreate(Class<T> type)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      getOrCreate in interface com.vaadin.flow.di.Instantiator
    • getServiceInitListeners

      public Stream<com.vaadin.flow.server.VaadinServiceInitListener> getServiceInitListeners()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      getServiceInitListeners in interface com.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:
      getIndexHtmlRequestListeners in interface com.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:
      getDependencyFilters in interface com.vaadin.flow.di.Instantiator
    • getApplicationClass

      public Class<?> getApplicationClass(Object instance)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      getApplicationClass in interface com.vaadin.flow.di.Instantiator
    • getApplicationClass

      public Class<?> getApplicationClass(Class<?> clazz)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      getApplicationClass in interface com.vaadin.flow.di.Instantiator
    • createRouteTarget

      public <T extends com.vaadin.flow.component.HasElement> T createRouteTarget(Class<T> routeTargetType, com.vaadin.flow.router.NavigationEvent event)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      createRouteTarget in interface com.vaadin.flow.di.Instantiator
    • createComponent

      public <T extends com.vaadin.flow.component.Component> T createComponent(Class<T> componentClass)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      createComponent in interface com.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:
      getI18NProvider in interface com.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:
      getMenuAccessControl in interface com.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:
      getPageTitleGenerator in interface com.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.
      Returns delegate as is: wrapping it changes nothing, and a wrapper risks dropping methods added to Instantiator in the future.
      Parameters:
      delegate - the instantiator to return
      Returns:
      the given instantiator, unwrapped