com.holonplatform.vaadin.navigator.internal

## Class DefaultViewProvider

- java.lang.Object
- - com.holonplatform.vaadin.navigator.internal.DefaultViewProvider

- All Implemented Interfaces:
    ViewProcessorProvider, com.vaadin.navigator.ViewProvider, Serializable

      public class DefaultViewProvider
      extends Object
      implements ViewProcessorProvider

  Default `ViewProvider` with `StatefulView` instances management.

  Use `registerView(String, Class)` to register `View` classes and mapping them to view names. A view name must be unique whithin provider registered views.

  View instances will be created according to view scope: for stateful views, an instance is created at first request (for each UI) and the same instance is returned to subsequent view requests. On the contrary, for standard views, a new instance is created and returned to Navigator for every view request.

  View name fragment to match with registered view names is extracted from view request string (the URL part after `#!` characters) using the longest first part before `/` character which corresponds to a registered view name.

  Since:
    5.0.0
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultViewProvider()` Constructor

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `com.vaadin.navigator.View` | `getView(String viewName)`
    `String` | `getViewName(String viewAndParameters)`
    `com.vaadin.navigator.View` | `processViewInstance(ViewConfiguration.ViewConfigurationProvider viewConfigurationProvider, com.vaadin.navigator.View view)` Process given View instance for additional operations
    `void` | `registerView(String viewName, Class<? extends com.vaadin.navigator.View> viewClass)` Register a View class bounding it to given `viewName`.

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### DefaultViewProvider

          public DefaultViewProvider()

      Constructor

  - ### Method Detail

    - #### registerView

          public void registerView(String viewName,
                                   Class<? extends com.vaadin.navigator.View> viewClass)
                            throws ViewConfiguration.ViewConfigurationException

      Register a View class bounding it to given `viewName`.

      View name must be unique within registered views, otherwise a ViewConfigurationException is thrown.

      Parameters:
        `viewName` - View name
        `viewClass` - View class
      Throws:
        `ViewConfiguration.ViewConfigurationException` - Failed to register view

    - #### getViewName

          public String getViewName(String viewAndParameters)

      Specified by:
        `getViewName` in interface `com.vaadin.navigator.ViewProvider`

    - #### getView

          public com.vaadin.navigator.View getView(String viewName)

      Specified by:
        `getView` in interface `com.vaadin.navigator.ViewProvider`

    - #### processViewInstance

          public com.vaadin.navigator.View processViewInstance(ViewConfiguration.ViewConfigurationProvider viewConfigurationProvider,
                                                               com.vaadin.navigator.View view)
                                                        throws ViewConfiguration.ViewConfigurationException

      Description copied from interface: `ViewProcessorProvider`
      Process given View instance for additional operations
      Specified by:
        `processViewInstance` in interface `ViewProcessorProvider`
      Parameters:
        `viewConfigurationProvider` - ViewConfigurationProvider
        `view` - View instance
      Returns:
        Processed View
      Throws:
        `ViewConfiguration.ViewConfigurationException` - Error processing View instance

Copyright © 2019 The Holon Platform. All rights reserved.