Class PathUtil

java.lang.Object
com.vaadin.flow.router.internal.PathUtil
All Implemented Interfaces:
Serializable

public class PathUtil extends Object implements Serializable
Utility class which contains various methods for parsing a route url into segments.

For internal use only. May be renamed or removed in a future release.

See Also:
  • Constructor Details

    • PathUtil

      public PathUtil()
  • Method Details

    • getSegmentsList

      public static List<String> getSegmentsList(String path)
      Returns an unmodifiable list containing the segments of the specified path.
      Parameters:
      path - url path to split into segments. The path may also start with a slash `/` but it may not contain the url protocol.
      Returns:
      a List containing the segments of the path.
    • getPath

      public static String getPath(List<String> segments)
      Join the segments into a url path.
      Parameters:
      segments - path segments.
      Returns:
      path form from input segments.
    • getPath

      public static String getPath(String basePath, List<String> segments)
      Join the segments into a url path.
      Parameters:
      basePath - path prefix.
      segments - path segments following the prefix.
      Returns:
      the path form by concatenating basePath and segments.
    • trimPath

      public static String trimPath(String path)
      Trim the path by removing any leading and trailing whitespaces and slashes.
      Parameters:
      path - url path to trim.
      Returns:
      a String representing the input path without any leading and trailing whitespaces and slashes.
    • trimSegmentsString

      public static String trimSegmentsString(String path)
      Trim the path by removing any leading and trailing whitespaces and trailing slashes.
      Parameters:
      path - url path to trim, not null
      Returns:
      a String representing the input path without any leading and trailing whitespaces or trailing slash.