Class 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 given relativePath based on the given anchorPath.
      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)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • PATH_SEPARATOR_REGEX

        public static final java.util.regex.Pattern PATH_SEPARATOR_REGEX
    • Constructor Detail

      • PathUtils

        private PathUtils()
    • Method Detail

      • resolveRelativePath

        public static java.lang.String resolveRelativePath​(java.lang.String relativePath,
                                                           java.lang.String anchorPath,
                                                           char expectedSeparator)
        Resolves the given relativePath based on the given anchorPath.
        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)