Class DocumentNameMatcher

java.lang.Object
org.apache.rat.document.DocumentNameMatcher

public final class DocumentNameMatcher extends Object
Matches document names.
  • Field Details

    • MATCHES_ALL

      public static final DocumentNameMatcher MATCHES_ALL
      A matcher that matches all documents.
    • MATCHES_NONE

      public static final DocumentNameMatcher MATCHES_NONE
      A matcher that matches no documents.
  • Constructor Details

    • DocumentNameMatcher

      public DocumentNameMatcher(String name, Predicate<DocumentName> predicate)
      Constructs a DocumentNameMatcher from a name and a DocumentName predicate.
      Parameters:
      name - the name for this matcher.
      predicate - the predicate to determine matches.
    • DocumentNameMatcher

      public DocumentNameMatcher(String name, DocumentNameMatcher delegate)
      Constructs a DocumentNameMatcher from a name and a delegate DocumentNameMatcher.
      Parameters:
      name - the name for this matcher.
      delegate - the delegate to defer to.
    • DocumentNameMatcher

      public DocumentNameMatcher(String name, MatchPatterns patterns, DocumentName basedir)
      Constructs a DocumentNameMatcher from a name a MatchPatterns instance and the DocumentName for the base name.
      Parameters:
      name - the name of this matcher.
      patterns - the patterns in the matcher.
      basedir - the base directory for the scanning.
    • DocumentNameMatcher

      public DocumentNameMatcher(String name, MatchPatterns matchers)
      Constructs a DocumentNameMatcher from a name and a DocumentName predicate.
      Parameters:
      name - the name of the matcher.
      matchers - fully specified matchers.
    • DocumentNameMatcher

      public DocumentNameMatcher(String name, FileFilter fileFilter)
      Creates a DocumentNameMatcher from a File filter.
      Parameters:
      name - The name of this matcher.
      fileFilter - the file filter to execute.
    • DocumentNameMatcher

      public DocumentNameMatcher(FileFilter fileFilter)
      Creates a DocumentNameMatcher from a File filter.
      Parameters:
      fileFilter - the file filter to execute.
  • Method Details

    • isCollection

      public boolean isCollection()
    • getPredicate

      public Predicate<DocumentName> getPredicate()
      Returns the predicate that this DocumentNameMatcher is using.
      Returns:
      The predicate that this DocumentNameMatcher is using.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • decompose

      public List<DocumentNameMatcher.DecomposeData> decompose(DocumentName candidate)
      Decomposes the matcher execution against the candidate.
      Parameters:
      candidate - the candidate to check.
      Returns:
      a list of DocumentNameMatcher.DecomposeData for each evaluation in the matcher.
    • matches

      public boolean matches(DocumentName documentName)
      Performs the match against the DocumentName.
      Parameters:
      documentName - the document name to check.
      Returns:
      true if the documentName matchers this DocumentNameMatcher.
    • not

      public static DocumentNameMatcher not(DocumentNameMatcher nameMatcher)
      Performs a logical NOT on a DocumentNameMatcher.
      Parameters:
      nameMatcher - the matcher to negate.
      Returns:
      a PathMatcher that is the negation of the argument.
    • or

      public static DocumentNameMatcher or(Collection<DocumentNameMatcher> matchers)
      Performs a logical OR across the collection of matchers.
      Parameters:
      matchers - the matchers to check.
      Returns:
      a matcher that returns true if any of the enclosed matchers returns true.
    • or

      public static DocumentNameMatcher or(DocumentNameMatcher... matchers)
      Performs a logical OR across the collection of matchers.
      Parameters:
      matchers - the matchers to check.
      Returns:
      a matcher that returns true if any of the enclosed matchers returns true.
    • and

      public static DocumentNameMatcher and(Collection<DocumentNameMatcher> matchers)
      Performs a logical AND across the collection of matchers.
      Parameters:
      matchers - the matchers to check.
      Returns:
      a matcher that returns true if all the enclosed matchers return true.
    • matcherSet

      public static DocumentNameMatcher matcherSet(DocumentNameMatcher includes, DocumentNameMatcher excludes)
      A particular matcher that will not match any excluded unless they are listed in the includes.
      Parameters:
      includes - the DocumentNameMatcher to match the includes.
      excludes - the DocumentNameMatcher to match the excludes.
      Returns:
      a DocumentNameMatcher with the specified logic.
    • and

      public static DocumentNameMatcher and(DocumentNameMatcher... matchers)
      Performs a logical AND across the collection of matchers.
      Parameters:
      matchers - the matchers to check.
      Returns:
      a matcher that returns true if all the enclosed matchers return true.