java.lang.Object
software.xdev.testcontainers.imagebuilder.jgit.ignore.internal.AbstractMatcher
software.xdev.testcontainers.imagebuilder.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 Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final boolean
     
    protected final char
     
    protected final String
     

    Fields inherited from class software.xdev.testcontainers.imagebuilder.jgit.ignore.internal.AbstractMatcher

    dirOnly, pattern

    Fields inherited from interface software.xdev.testcontainers.imagebuilder.jgit.ignore.IMatcher

    NO_MATCH
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    NameMatcher(String pattern, Character pathSeparator, boolean dirOnly, boolean deleteBackslash)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    matches(String path, boolean assumeDirectory, boolean pathMatch)
    Matches entire given string
    boolean
    matches(String segment, int startIncl, int endExcl)
    Matches only part of given string

    Methods inherited from class software.xdev.testcontainers.imagebuilder.jgit.ignore.internal.AbstractMatcher

    equals, hashCode, toString

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • beginning

      protected final boolean beginning
    • slash

      protected final char slash
    • subPattern

      protected final String subPattern
  • Constructor Details

    • NameMatcher

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

    • matches

      public boolean matches(String path, boolean assumeDirectory, boolean pathMatch)
      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)
      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)
      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
      Returns:
      true if this matcher pattern matches given string