Class NameMatcher

java.lang.Object
org.eclipse.jgit.ignore.internal.AbstractMatcher
org.eclipse.jgit.ignore.internal.NameMatcher
All Implemented Interfaces:
IMatcher
Direct Known Subclasses:
LeadingAsteriskMatcher, TrailingAsteriskMatcher, WildCardMatcher

public class NameMatcher extends AbstractMatcher
Matcher built from patterns for file names (single path segments). This class is immutable and thread safe.
  • Field Details

    • beginning

      final boolean beginning
    • slash

      final char slash
    • subPattern

      final String subPattern
  • Constructor Details

    • NameMatcher

      NameMatcher(String pattern, Character pathSeparator, boolean dirOnly, boolean deleteBackslash)
  • Method Details

    • matches

      public boolean matches(String path, boolean assumeDirectory, boolean pathMatch)
      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)
      pathMatch - true if the match is for the full path: prefix-only matches are not allowed
      Returns:
      true if this matcher pattern matches given string
    • matches

      public boolean matches(String segment, int startIncl, int endExcl)
      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
      Returns:
      true if this matcher pattern matches given string