Package io.pebbletemplates.pebble.utils
Class PathUtils
- java.lang.Object
-
- io.pebbletemplates.pebble.utils.PathUtils
-
public final class PathUtils extends java.lang.Object
Utility class to handle relative paths.
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.regex.Pattern
PATH_SEPARATOR_REGEX
-
Constructor Summary
Constructors Modifier Constructor Description private
PathUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static java.util.Collection<java.lang.String>
determineAnchorPathSegments(java.lang.String anchorPath, char separator)
private static java.lang.String
resolvePathInner(java.lang.String relativePath, java.lang.String anchorPath, char separator)
private static java.util.Collection<java.lang.String>
resolvePathSegments(java.util.Collection<java.lang.String> anchorSegments, java.util.Collection<java.lang.String> relativeSegments)
static java.lang.String
resolveRelativePath(java.lang.String relativePath, java.lang.String anchorPath, char expectedSeparator)
Resolves the givenrelativePath
based on the givenanchorPath
.private static java.lang.String
sanitize(java.lang.String path, char expectedSeparator)
private static java.util.List<java.lang.String>
splitBySeparator(java.lang.String path, char separator)
-
-
-
Method Detail
-
resolveRelativePath
public static java.lang.String resolveRelativePath(java.lang.String relativePath, java.lang.String anchorPath, char expectedSeparator)
Resolves the givenrelativePath
based on the givenanchorPath
.- Parameters:
relativePath
- the relative path which should be resolved.anchorPath
- the anchor path based on which the relative path should be resolved on.expectedSeparator
- The character expected to be used as a separator; dictated by the Loader.- Returns:
- the resolved path or
null
when the path could not be resolved.
-
sanitize
private static java.lang.String sanitize(java.lang.String path, char expectedSeparator)
-
resolvePathInner
private static java.lang.String resolvePathInner(java.lang.String relativePath, java.lang.String anchorPath, char separator)
-
determineAnchorPathSegments
private static java.util.Collection<java.lang.String> determineAnchorPathSegments(java.lang.String anchorPath, char separator)
-
resolvePathSegments
private static java.util.Collection<java.lang.String> resolvePathSegments(java.util.Collection<java.lang.String> anchorSegments, java.util.Collection<java.lang.String> relativeSegments)
-
splitBySeparator
private static java.util.List<java.lang.String> splitBySeparator(java.lang.String path, char separator)
-
-