com.vaadin.flow.router.
Class RouteParameters
- java.lang.Object
-
- com.vaadin.flow.router.RouteParameters
-
All Implemented Interfaces:
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 Summary
Constructors Constructor Description RouteParameters(RouteParam... params)
Creates a RouteParameters container using the given
RouteParam
s.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 Modifier and Type Method Description static RouteParameters
empty()
Creates an empty RouteParameters instance.
boolean
equals(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.
int
hashCode()
String
toString()
-
-
-
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 given
RouteParam
s.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
Optional
Integer
representation of the parameter. If the value is missing theOptional
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 theOptional
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
.
-
-