Package com.vaadin.flow.router.internal
Class HasUrlParameterFormat
java.lang.Object
com.vaadin.flow.router.internal.HasUrlParameterFormat
- All Implemented Interfaces:
Serializable
Utility methods to transform urls and parameters from/into the
HasUrlParameter format into/from the template format.
For internal use only. May be renamed or removed in a future release.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringReserved parameter placeholder used when setup internally route path pattern with the parameter design for backward compatibility withHasUrlParameter.static final StringReserved parameter name used when setup internally route path pattern with the parameter design for backward compatibility withHasUrlParameter. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcheckMandatoryParameter(Class<? extends Component> navigationTarget, RouteParameters parameters) Verify whether the navigationTarget has mandatory parameter and complies with the given parameter values.static <T> RouteParametersgetParameters(List<T> parametersList) Transform theHasUrlParametervalues into aRouteParametersobject.static <T> RouteParametersgetParameters(T parameter) Transform theHasUrlParametervalue into aRouteParametersobject.getParameterTypes(Collection<String> types) Gets the types of the parameters from string format.getParameterValues(RouteParameters parameters) Gets the values for theHasUrlParameterfrom the specified route parameters.static StringgetTemplate(String urlBase, Class<? extends Component> navigationTarget) Gets the template for the given url base by appending the parameter according to the given navigationTarget if it's implementingHasUrlParameterstatic <T> StringGets the final url by appending the given parameters.static StringgetUrlBase(String template) Gets the url base without the parameter for the given template and navigation target implementing *HasUrlParameter.
-
Field Details
-
PARAMETER_NAME
Reserved parameter name used when setup internally route path pattern with the parameter design for backward compatibility withHasUrlParameter.- See Also:
-
PARAMETER
Reserved parameter placeholder used when setup internally route path pattern with the parameter design for backward compatibility withHasUrlParameter.- See Also:
-
-
Method Details
-
getTemplate
Gets the template for the given url base by appending the parameter according to the given navigationTarget if it's implementingHasUrlParameter- Parameters:
urlBase- url base.navigationTarget-HasUrlParameternavigation target.- Returns:
- the final template.
-
getUrlBase
Gets the url base without the parameter for the given template and navigation target implementing *HasUrlParameter.- Parameters:
template- the template.- Returns:
- the url base excluding the parameter placeholder.
-
getUrl
Gets the final url by appending the given parameters.- Type Parameters:
T- type of the values.- Parameters:
url- url base.parameters-HasUrlParameterparameter values.- Returns:
- navigation url string.
-
getParameters
Transform theHasUrlParametervalue into aRouteParametersobject.- Type Parameters:
T- type of the input value.- Parameters:
parameter- the parameter values.- Returns:
- RouteParameters instance wrapping the given parameter.
-
getParameters
Transform theHasUrlParametervalues into aRouteParametersobject.- Type Parameters:
T- type of the input values.- Parameters:
parametersList- the list of values.- Returns:
- RouteParameters instance wrapping the given parameters.
-
getParameterValues
Gets the values for theHasUrlParameterfrom the specified route parameters.- Parameters:
parameters- route parameter.- Returns:
- HasUrlParameter compatible values.
-
getParameterTypes
Gets the types of the parameters from string format.- Parameters:
types- the input string format types.- Returns:
- the class types of the parameters.
-
checkMandatoryParameter
public static void checkMandatoryParameter(Class<? extends Component> navigationTarget, RouteParameters parameters) Verify whether the navigationTarget has mandatory parameter and complies with the given parameter values.- Parameters:
navigationTarget- navigation target.parameters- navigation route parameters.
-