com.holonplatform.vaadin.flow.navigator

## Interface NavigationParameters

- All Superinterfaces:
    Serializable
  All Known Implementing Classes:
    DefaultNavigationParameters

      public interface NavigationParameters
      extends Serializable

  URL navigation parameter handler API, which provides deserialized URL query parameter values.
  Since:
    5.2.2

- - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `static NavigationParameters` | `create(com.vaadin.flow.router.Location location)` Create a new `NavigationParameters` instance.
    `static NavigationParameters` | `create(com.vaadin.flow.router.Location location, boolean decode)` Create a new `NavigationParameters` instance.
    `static NavigationParameters` | `create(Map<String,List<String>> queryParameters)` Create a new `NavigationParameters` instance.
    `static NavigationParameters` | `create(Map<String,List<String>> queryParameters, boolean decode)` Create a new `NavigationParameters` instance.
    `static NavigationParameters` | `create(com.vaadin.flow.router.QueryParameters queryParameters)` Create a new `NavigationParameters` instance.
    `static NavigationParameters` | `create(com.vaadin.flow.router.QueryParameters queryParameters, boolean decode)` Create a new `NavigationParameters` instance.
    `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.

- - ### Method Detail

    - #### getQueryParameters

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

      Get the URL query parameters, without any value deserialization.
      Returns:
        A map of query parameter name and values

    - #### hasQueryParameter

          boolean hasQueryParameter(String name)

      Checks whether the query parameter with the given `name` is available and has a value.
      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

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

      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`.

      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

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

      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`.

      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

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

      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`.

      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

    - #### create

          static NavigationParameters create(Map<String,List<String>> queryParameters)

      Create a new `NavigationParameters` instance.

      The query parameter names and values will be decoded from URL representation, using the `UTF-8` charset.

      Parameters:
        `queryParameters` - Query parameter names and values
      Returns:
        A new `NavigationParameters` to handle given navigation parameters

    - #### create

          static NavigationParameters create(Map<String,List<String>> queryParameters,
                                             boolean decode)

      Create a new `NavigationParameters` instance.
      Parameters:
        `queryParameters` - Query parameter names and values
        `decode` - Whether to decode the parameter names and values from URL representation, using the `UTF-8` charset
      Returns:
        A new `NavigationParameters` to handle given navigation parameters

    - #### create

          static NavigationParameters create(com.vaadin.flow.router.QueryParameters queryParameters)

      Create a new `NavigationParameters` instance.

      The query parameter names and values will be decoded from URL representation, using the `UTF-8` charset.

      Parameters:
        `queryParameters` - The query parameters holder
      Returns:
        A new `NavigationParameters` to handle given navigation parameters

    - #### create

          static NavigationParameters create(com.vaadin.flow.router.QueryParameters queryParameters,
                                             boolean decode)

      Create a new `NavigationParameters` instance.
      Parameters:
        `queryParameters` - The query parameters holder
        `decode` - Whether to decode the parameter names and values from URL representation, using the `UTF-8` charset
      Returns:
        A new `NavigationParameters` to handle given navigation parameters

    - #### create

          static NavigationParameters create(com.vaadin.flow.router.Location location)

      Create a new `NavigationParameters` instance.

      The query parameter names and values will be decoded from the URL representation, using the `UTF-8` charset.

      Parameters:
        `location` - The URL location representation
      Returns:
        A new `NavigationParameters` to handle given location parameters

    - #### create

          static NavigationParameters create(com.vaadin.flow.router.Location location,
                                             boolean decode)

      Create a new `NavigationParameters` instance.
      Parameters:
        `location` - The URL location representation
        `decode` - Whether to decode the query parameter names and values from the URL representation, using the `UTF-8` charset
      Returns:
        A new `NavigationParameters` to handle given location parameters

Copyright © 2019 The Holon Platform. All rights reserved.