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 class
Data from adecompose(DocumentName)
call.static class
A DocumentName predicate that usesFileFilter
.static class
A DocumentName predicate that usesMatchPatterns
.static class
A DocumentName predicate that reverses another DocumentNameMatcher. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic DocumentNameMatcher
A matcher that matches all documents.static DocumentNameMatcher
A 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 DocumentNameMatcher
and(Collection<DocumentNameMatcher> matchers)
Performs a logicalAND
across the collection of matchers.static DocumentNameMatcher
and(DocumentNameMatcher... matchers)
Performs a logicalAND
across the collection of matchers.decompose(DocumentName candidate)
Decomposes the matcher execution against the candidate.Returns the predicate that this DocumentNameMatcher is using.boolean
boolean
logDecompositionWhileMatching(DocumentName candidate)
Calculates the match result and logs the calculations.static DocumentNameMatcher
matcherSet(DocumentNameMatcher includes, DocumentNameMatcher excludes)
A particular matcher that will not match any excluded unless they are listed in the includes.boolean
matches(DocumentName documentName)
Performs the match against the DocumentName.static DocumentNameMatcher
not(DocumentNameMatcher nameMatcher)
Performs a logicalNOT
on a DocumentNameMatcher.static DocumentNameMatcher
or(Collection<DocumentNameMatcher> matchers)
Performs a logicalOR
across the collection of matchers.static DocumentNameMatcher
or(DocumentNameMatcher... matchers)
Performs a logicalOR
across 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.DecomposeData
for 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 logicalNOT
on a DocumentNameMatcher.- Parameters:
nameMatcher
- the matcher to negate.- Returns:
- a PathMatcher that is the negation of the argument.
-
or
Performs a logicalOR
across the collection of matchers.- Parameters:
matchers
- the matchers to check.- Returns:
- a matcher that returns
true
if any of the enclosed matchers returnstrue
.
-
or
Performs a logicalOR
across the collection of matchers.- Parameters:
matchers
- the matchers to check.- Returns:
- a matcher that returns
true
if any of the enclosed matchers returnstrue
.
-
and
Performs a logicalAND
across the collection of matchers.- Parameters:
matchers
- the matchers to check.- Returns:
- a matcher that returns
true
if 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 logicalAND
across the collection of matchers.- Parameters:
matchers
- the matchers to check.- Returns:
- a matcher that returns
true
if all the enclosed matchers returntrue
.
-