com.vaadin.flow.router.internal.
Class PathUtil
- java.lang.Object
-
- com.vaadin.flow.router.internal.PathUtil
-
All Implemented Interfaces:
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 Summary
Constructors Constructor Description PathUtil()
-
Method Summary
All Methods Modifier and Type Method Description static String
getPath(String basePath, List<String> segments)
Join the segments into a url path.
static String
getPath(List<String> segments)
Join the segments into a url path.
static List<String>
getSegmentsList(String path)
Returns an unmodifiable list containing the segments of the specified path.
static String
trimPath(String path)
Trim the path by removing any leading and trailing whitespaces and slashes.
static String
trimSegmentsString(String path)
Trim the path by removing any leading and trailing whitespaces and trailing slashes.
-
-
-
Method Detail
-
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 nullReturns:
a String representing the input path without any leading and trailing whitespaces or trailing slash.
-
-