com.vaadin.flow.router.

Class RouteParameters

java.lang.Object
com.vaadin.flow.router.RouteParameters

All Implemented Interfaces:

Serializable

public final class RouteParameters extends Object implements Serializable

Immutable container which stores the route parameters extracted from a navigation url received from the client.

See Also:

  • Constructor Details

    • RouteParameters

      public RouteParameters(Map<String,String> params)

      Creates a RouteParameters container using the given map as argument.

      Parameters:

      params - parameters mapping containing the parameter names mapping their values.

    • RouteParameters

      public RouteParameters(RouteParam... params)

      Creates a RouteParameters container using the given RouteParams.

      Parameters:

      params - the list of parameters and their values.

      Throws:

      IllegalArgumentException - if a parameter is given more than once.

    • RouteParameters

      public RouteParameters(String name, String value)

      Creates a RouteParameters instance using only one parameter.

      Parameters:

      name - the name of the parameter.

      value - the value of the parameter.

  • Method Details

    • empty

      public static RouteParameters empty()

      Creates an empty RouteParameters instance.

      Returns:

      an empty instance of RouteParameters.

    • getParameterNames

      public Set<String> getParameterNames()

      Gets the available parameter names.

      Returns:

      the available parameter names.

    • get

      public Optional<String> get(String parameterName)

      Gets the string representation of a parameter.

      Parameters:

      parameterName - the name of the parameter.

      Returns:

      an Optional String representation of the parameter. If the value is missing the Optional is empty.

    • getInteger

      public Optional<Integer> getInteger(String parameterName)

      Gets the int representation of a parameter.

      Parameters:

      parameterName - the name of the parameter.

      Returns:

      an Optional Integer representation of the parameter. If the value is missing the Optional is empty.

      Throws:

      NumberFormatException - if the value cannot be parsed as an Integer.

    • getLong

      public Optional<Long> getLong(String parameterName)

      Gets the long representation of a parameter.

      Parameters:

      parameterName - the name of the parameter.

      Returns:

      an Optional Long representation of the parameter. If the value is missing the Optional is empty.

      Throws:

      NumberFormatException - if the value cannot be parsed as a Long.

    • getWildcard

      public List<String> getWildcard(String parameterName)

      Gets a list representing the wildcard value of a parameter, where each element in the list is a path segment. In case the value is missing the result is an empty List.

      Parameters:

      parameterName - the name of the parameter.

      Returns:

      a List representing the wildcard value of a parameter, or an empty List is the value is missing.

    • toString

      public String toString()

      Overrides:

      toString in class Object

    • equals

      public boolean equals(Object obj)

      Overrides:

      equals in class Object

    • hashCode

      public int hashCode()

      Overrides:

      hashCode in class Object