Class PathMatcher

  • All Implemented Interfaces:
    IMatcher

    public class PathMatcher
    extends AbstractMatcher
    Matcher built by patterns consists of multiple path segments.

    This class is immutable and thread safe.

    Since:
    3.6
    • Field Summary

      • Fields inherited from interface org.eclipse.jgit.ignore.internal.IMatcher

        NO_MATCH
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static IMatcher createPathMatcher​(java.lang.String pattern, java.lang.Character pathSeparator, boolean dirOnly)  
      boolean matches​(java.lang.String path, boolean assumeDirectory)
      Matches entire given string
      boolean matches​(java.lang.String segment, int startIncl, int endExcl, boolean assumeDirectory)
      Matches only part of given string
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Method Detail

      • createPathMatcher

        public static IMatcher createPathMatcher​(java.lang.String pattern,
                                                 java.lang.Character pathSeparator,
                                                 boolean dirOnly)
                                          throws InvalidPatternException
        Parameters:
        pattern -
        pathSeparator - if this parameter isn't null then this character will not match at wildcards(* and ? are wildcards).
        dirOnly -
        Returns:
        never null
        Throws:
        InvalidPatternException
      • matches

        public boolean matches​(java.lang.String path,
                               boolean assumeDirectory)
        Description copied from interface: IMatcher
        Matches entire given string
        Parameters:
        path - string which is not null, but might be empty
        assumeDirectory - true to assume this path as directory (even if it doesn't end with a slash)
        Returns:
        true if this matcher pattern matches given string
      • matches

        public boolean matches​(java.lang.String segment,
                               int startIncl,
                               int endExcl,
                               boolean assumeDirectory)
        Description copied from interface: IMatcher
        Matches only part of given string
        Parameters:
        segment - string which is not null, but might be empty
        startIncl - start index, inclusive
        endExcl - end index, exclusive
        assumeDirectory - true to assume this path as directory (even if it doesn't end with a slash)
        Returns:
        true if this matcher pattern matches given string