com.vaadin.flow.router.internal.

Class HasUrlParameterFormat

java.lang.Object
com.vaadin.flow.router.internal.HasUrlParameterFormat

All Implemented Interfaces:

Serializable

public class HasUrlParameterFormat extends Object implements 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 Details

    • PARAMETER_NAME

      public static final String PARAMETER_NAME

      Reserved parameter name used when setup internally route path pattern with the parameter design for backward compatibility with HasUrlParameter.

      See Also:

    • PARAMETER

      public static final String PARAMETER

      Reserved parameter placeholder used when setup internally route path pattern with the parameter design for backward compatibility with HasUrlParameter.

      See Also:

  • Method Details

    • getTemplate

      public static String getTemplate(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 implementing HasUrlParameter

      Parameters:

      urlBase - url base.

      navigationTarget - HasUrlParameter navigation target.

      Returns:

      the final template.

    • getUrlBase

      public static String getUrlBase(String template)

      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

      public static <T> String getUrl(String url, List<T> parameters)

      Gets the final url by appending the given parameters.

      Type Parameters:

      T - type of the values.

      Parameters:

      url - url base.

      parameters - HasUrlParameter parameter values.

      Returns:

      navigation url string.

    • getParameters

      public static <T> RouteParameters getParameters(T parameter)

      Transform the HasUrlParameter value into a RouteParameters object.

      Type Parameters:

      T - type of the input value.

      Parameters:

      parameter - the parameter values.

      Returns:

      RouteParameters instance wrapping the given parameter.

    • getParameters

      public static <T> RouteParameters getParameters(List<T> parametersList)

      Transform the HasUrlParameter values into a RouteParameters object.

      Type Parameters:

      T - type of the input values.

      Parameters:

      parametersList - the list of values.

      Returns:

      RouteParameters instance wrapping the given parameters.

    • getParameterValues

      public static List<String> getParameterValues(RouteParameters parameters)

      Gets the values for the HasUrlParameter from the specified route parameters.

      Parameters:

      parameters - route parameter.

      Returns:

      HasUrlParameter compatible values.

    • getParameterTypes

      public static List<Class<?>> getParameterTypes(Collection<String> types)

      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.