com.holonplatform.vaadin.flow.navigator.internal

## Class DefaultNavigationParameters

- java.lang.Object
- - com.holonplatform.vaadin.flow.navigator.internal.DefaultNavigationParameters

- All Implemented Interfaces:
    NavigationParameters, Serializable

      public class DefaultNavigationParameters
      extends Object
      implements NavigationParameters

  Default `NavigationParameters` implementation.
  Since:
    5.2.2
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultNavigationParameters(Map<String,List<String>> queryParameters, boolean decode)` Constructor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Map<String,List<String>>` | `getQueryParameters()` Get the URL query parameters, without any value deserialization.
    `<T> Optional<T>` | `getQueryParameterValue(String name, Class<T> type)` Get the single value of the query parameter with the given `name`, deserializing it to the given value `type`.
    `<T> T` | `getQueryParameterValue(String name, Class<T> type, T defaultValue)` Get the single value of the query parameter with the given `name`, deserializing it to the given value `type`.
    `<T> List<T>` | `getQueryParameterValues(String name, Class<T> type)` Get the values of the query parameter with the given `name`, deserializing it to the given value `type`.
    `boolean` | `hasQueryParameter(String name)` Checks whether the query parameter with the given `name` is available and has a value.

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

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

    - ### Methods inherited from interface com.holonplatform.vaadin.flow.navigator.NavigationParameters

      `create, create, create, create, create, create`

- - ### Constructor Detail

    - #### DefaultNavigationParameters

          public DefaultNavigationParameters(Map<String,List<String>> queryParameters,
                                             boolean decode)

      Constructor.
      Parameters:
        `queryParameters` - Query parameter names and values
        `decode` - Whether to decode the parameter names and values from URL representation, using the `UTF-8` charset

  - ### Method Detail

    - #### getQueryParameters

          public Map<String,List<String>> getQueryParameters()

      Description copied from interface: `NavigationParameters`
      Get the URL query parameters, without any value deserialization.
      Specified by:
        `getQueryParameters` in interface `NavigationParameters`
      Returns:
        A map of query parameter name and values

    - #### hasQueryParameter

          public boolean hasQueryParameter(String name)

      Description copied from interface: `NavigationParameters`
      Checks whether the query parameter with the given `name` is available and has a value.
      Specified by:
        `hasQueryParameter` in interface `NavigationParameters`
      Parameters:
        `name` - The query parameter name (not null)
      Returns:
        `true` if the query parameter with the given `name` is available and has a value, `false` otherwise

    - #### getQueryParameterValues

          public <T> List<T> getQueryParameterValues(String name,
                                                     Class<T> type)
                                              throws InvalidNavigationParameterException

      Description copied from interface: `NavigationParameters`
      Get the values of the query parameter with the given `name`, deserializing it to the given value `type`.

      The query parameter values are deserialized using the `NavigationParameterMapper`.

      Specified by:
        `getQueryParameterValues` in interface `NavigationParameters`
      Type Parameters:
        `T` - Deserialized value type
      Parameters:
        `name` - The query parameter name (not null)
        `type` - The type into which the query parameter values have to be deserialized (not null)
      Returns:
        The deserialized query parameter values, an empty `List` if none
      Throws:
        `InvalidNavigationParameterException` - If a deserialization error occurred

    - #### getQueryParameterValue

          public <T> Optional<T> getQueryParameterValue(String name,
                                                        Class<T> type)
                                                 throws InvalidNavigationParameterException

      Description copied from interface: `NavigationParameters`
      Get the single value of the query parameter with the given `name`, deserializing it to the given value `type`.

      If the query parameter has more than one value, only the first one is returned.

      The query parameter value is deserialized using the `NavigationParameterMapper`.

      Specified by:
        `getQueryParameterValue` in interface `NavigationParameters`
      Type Parameters:
        `T` - Deserialized value type
      Parameters:
        `name` - The query parameter name (not null)
        `type` - The type into which the query parameter value has to be deserialized (not null)
      Returns:
        Optional deserialized query parameter value, if available
      Throws:
        `InvalidNavigationParameterException` - If a deserialization error occurred

    - #### getQueryParameterValue

          public <T> T getQueryParameterValue(String name,
                                              Class<T> type,
                                              T defaultValue)
                                       throws InvalidNavigationParameterException

      Description copied from interface: `NavigationParameters`
      Get the single value of the query parameter with the given `name`, deserializing it to the given value `type`.

      If the query parameter has more than one value, only the first one is returned.

      The query parameter value is deserialized using the `NavigationParameterMapper`.

      Specified by:
        `getQueryParameterValue` in interface `NavigationParameters`
      Type Parameters:
        `T` - Deserialized value type
      Parameters:
        `name` - The query parameter name (not null)
        `type` - The type into which the query parameter value has to be deserialized (not null)
        `defaultValue` - The default value to return if the query parameter has no value
      Returns:
        The deserialized query parameter value, or `defaultValue` if the query parameter has no value
      Throws:
        `InvalidNavigationParameterException` - If a deserialization error occurred

Copyright © 2020 The Holon Platform. All rights reserved.