Class PathMatchers


  • public class PathMatchers
    extends java.lang.Object
    Common PathMatcher implementations.
    • Constructor Summary

      Constructors 
      Constructor Description
      PathMatchers()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      private static java.nio.file.Path asPath​(java.lang.String pattern)
      Convert a pattern to a Path object.
      private static int countChars​(java.lang.String pattern, int offset, char c)  
      static java.nio.file.PathMatcher getMatcher​(java.lang.String rawpattern)  
      static java.nio.file.PathMatcher getNonHidden()  
      static java.nio.file.Path getSearchRoot​(java.lang.String pattern)
      Provide the non-glob / non-regex prefix on the pattern as a Path reference.
      static boolean isAbsolute​(java.lang.String pattern)
      Tests if provided pattern is an absolute reference (or not)
      private static boolean isGlob​(char c, boolean syntaxed)
      Determine if part is a glob pattern.
      • Methods inherited from class java.lang.Object

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

      • GLOB_CHARS

        private static final char[] GLOB_CHARS
      • SYNTAXED_GLOB_CHARS

        private static final char[] SYNTAXED_GLOB_CHARS
      • EMPTY_PATH

        private static final java.nio.file.Path EMPTY_PATH
    • Constructor Detail

      • PathMatchers

        public PathMatchers()
    • Method Detail

      • asPath

        private static java.nio.file.Path asPath​(java.lang.String pattern)
        Convert a pattern to a Path object.
        Parameters:
        pattern - the raw pattern (can contain "glob:" or "regex:" syntax indicator)
        Returns:
        the Path version of the pattern provided.
      • getMatcher

        public static java.nio.file.PathMatcher getMatcher​(java.lang.String rawpattern)
      • getNonHidden

        public static java.nio.file.PathMatcher getNonHidden()
      • getSearchRoot

        public static java.nio.file.Path getSearchRoot​(java.lang.String pattern)
        Provide the non-glob / non-regex prefix on the pattern as a Path reference.
        Parameters:
        pattern - the pattern to test
        Returns:
        the Path representing the search root for the pattern provided.
      • countChars

        private static int countChars​(java.lang.String pattern,
                                      int offset,
                                      char c)
      • isAbsolute

        public static boolean isAbsolute​(java.lang.String pattern)
        Tests if provided pattern is an absolute reference (or not)
        Parameters:
        pattern - the pattern to test
        Returns:
        true if pattern is an absolute reference.
      • isGlob

        private static boolean isGlob​(char c,
                                      boolean syntaxed)
        Determine if part is a glob pattern.
        Parameters:
        c - the char to check
        syntaxed - true if overall pattern is syntaxed with "glob:" or "regex:"
        Returns:
        true if part has glob characters