Package org.apache.rat.document
Class DocumentNameMatcher
java.lang.Object
org.apache.rat.document.DocumentNameMatcher
Matches document names.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classData from adecompose(DocumentName)call.static classA DocumentName predicate that usesFileFilter.static classA DocumentName predicate that usesMatchPatterns.static classA DocumentName predicate that reverses another DocumentNameMatcher. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic DocumentNameMatcherA matcher that matches all documents.static DocumentNameMatcherA matcher that matches no documents. -
Constructor Summary
ConstructorsConstructorDescriptionDocumentNameMatcher(FileFilter fileFilter)Creates a DocumentNameMatcher from a File filter.DocumentNameMatcher(String name, FileFilter fileFilter)Creates a DocumentNameMatcher from a File filter.DocumentNameMatcher(String name, Predicate<DocumentName> predicate)Constructs a DocumentNameMatcher from a name and a DocumentName predicate.DocumentNameMatcher(String name, MatchPatterns matchers)Constructs a DocumentNameMatcher from a name and a MatcherPatterns object.DocumentNameMatcher(String name, MatchPatterns patterns, DocumentName basedir)Constructs a DocumentNameMatcher from a name a MatchPatterns instance and the DocumentName for the base name.DocumentNameMatcher(String name, DocumentNameMatcher delegate)Constructs a DocumentNameMatcher from a name and a delegate DocumentNameMatcher. -
Method Summary
Modifier and TypeMethodDescriptionstatic DocumentNameMatcherand(Collection<DocumentNameMatcher> matchers)Performs a logicalANDacross the collection of matchers.static DocumentNameMatcherand(DocumentNameMatcher... matchers)Performs a logicalANDacross the collection of matchers.decompose(DocumentName candidate)Decomposes the matcher execution against the candidate.Returns the predicate that this DocumentNameMatcher is using.booleanbooleanlogDecompositionWhileMatching(DocumentName candidate)Calculates the match result and logs the calculations.static DocumentNameMatchermatcherSet(DocumentNameMatcher includes, DocumentNameMatcher excludes)A particular matcher that will not match any excluded unless they are listed in the includes.booleanmatches(DocumentName documentName)Performs the match against the DocumentName.static DocumentNameMatchernot(DocumentNameMatcher nameMatcher)Performs a logicalNOTon a DocumentNameMatcher.static DocumentNameMatcheror(Collection<DocumentNameMatcher> matchers)Performs a logicalORacross the collection of matchers.static DocumentNameMatcheror(DocumentNameMatcher... matchers)Performs a logicalORacross the collection of matchers.toString()
-
Field Details
-
MATCHES_ALL
A matcher that matches all documents. -
MATCHES_NONE
A matcher that matches no documents.
-
-
Constructor Details
-
DocumentNameMatcher
Constructs a DocumentNameMatcher from a name and a DocumentName predicate.- Parameters:
name- the name for this matcher.predicate- the predicate to determine matches.
-
DocumentNameMatcher
Constructs a DocumentNameMatcher from a name and a delegate DocumentNameMatcher.- Parameters:
name- the name for this matcher.delegate- the delegate to defer to.
-
DocumentNameMatcher
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
Constructs a DocumentNameMatcher from a name and a MatcherPatterns object.- Parameters:
name- the name of the matcher.matchers- fully specified matchers.
-
DocumentNameMatcher
Creates a DocumentNameMatcher from a File filter.- Parameters:
name- The name of this matcher.fileFilter- the file filter to execute.
-
DocumentNameMatcher
Creates a DocumentNameMatcher from a File filter.- Parameters:
fileFilter- the file filter to execute.
-
-
Method Details
-
isCollection
public boolean isCollection() -
getPredicate
Returns the predicate that this DocumentNameMatcher is using.- Returns:
- The predicate that this DocumentNameMatcher is using.
-
toString
-
logDecompositionWhileMatching
Calculates the match result and logs the calculations.- Parameters:
candidate- the candidate to evaluate the match for.- Returns:
- the result of the calculation
-
decompose
Decomposes the matcher execution against the candidate.- Parameters:
candidate- the candidate to check.- Returns:
- a list of
DocumentNameMatcher.DecomposeDatafor each evaluation in the matcher.
-
matches
Performs the match against the DocumentName.- Parameters:
documentName- the document name to check.- Returns:
- true if the documentName matchers this DocumentNameMatcher.
-
not
Performs a logicalNOTon a DocumentNameMatcher.- Parameters:
nameMatcher- the matcher to negate.- Returns:
- a PathMatcher that is the negation of the argument.
-
or
Performs a logicalORacross the collection of matchers.- Parameters:
matchers- the matchers to check.- Returns:
- a matcher that returns
trueif any of the enclosed matchers returnstrue.
-
or
Performs a logicalORacross the collection of matchers.- Parameters:
matchers- the matchers to check.- Returns:
- a matcher that returns
trueif any of the enclosed matchers returnstrue.
-
and
Performs a logicalANDacross the collection of matchers.- Parameters:
matchers- the matchers to check.- Returns:
- a matcher that returns
trueif all the enclosed matchers returntrue.
-
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
Performs a logicalANDacross the collection of matchers.- Parameters:
matchers- the matchers to check.- Returns:
- a matcher that returns
trueif all the enclosed matchers returntrue.
-