Package 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:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description RouteParameters(RouteParam... params)Creates a RouteParameters container using the givenRouteParams.RouteParameters(String name, String value)Creates a RouteParameters instance using only one parameter.RouteParameters(Map<String,String> params)Creates a RouteParameters container using the given map as argument.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static RouteParametersempty()Creates an empty RouteParameters instance.booleanequals(Object obj)Optional<String>get(String parameterName)Gets the string representation of a parameter.Optional<Integer>getInteger(String parameterName)Gets the int representation of a parameter.Optional<Long>getLong(String parameterName)Gets the long representation of a parameter.Set<String>getParameterNames()Gets the available parameter names.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.inthashCode()StringtoString()
-
-
-
Constructor Detail
-
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 givenRouteParams.- Parameters:
params- the list of parameters and their values.- Throws:
IllegalArgumentException- if a parameter is given more than once.
-
-
Method Detail
-
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.
-
getInteger
public Optional<Integer> getInteger(String parameterName)
Gets the int representation of a parameter.- Parameters:
parameterName- the name of the parameter.- Returns:
- an
OptionalIntegerrepresentation of the parameter. If the value is missing theOptionalis 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
OptionalLongrepresentation of the parameter. If the value is missing theOptionalis 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 emptyList.
-
-