Package org.apache.rat.config.exclusion
Class FileProcessor
java.lang.Object
org.apache.rat.config.exclusion.FileProcessor
- All Implemented Interfaces:
Function<DocumentName,
Iterable<String>>
- Direct Known Subclasses:
DescendingFileProcessor
The file processor reads the file specified in the DocumentName.
It must return a list of fully qualified strings for the
MatchPattern
to process.
It may return either Ant or Regex style strings, or a mixture of both.
See SelectorUtils
for a description of the formats.
It may also generate custom DocumentNameMatchers which are added to the customMatchers instance variable.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final List
<DocumentNameMatcher> The collection of custom DocumentNameMatchers generated by this processorstatic final FileProcessor
An empty file processor returning no entries.static final String
Prefix used to negate the given pattern.static final String
A String format pattern to print a regex string -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Protected constructor.FileProcessor
(Iterable<String> patterns) Create a file processor out of a list of file patterns. -
Method Summary
Modifier and TypeMethodDescriptionapply
(DocumentName documentName) final Iterable
<DocumentNameMatcher> If this FileProcessor builds custom matchers to handles special cases this method returns them to the processing stream.protected final String
localizePattern
(DocumentName documentName, String pattern) Modifies theMatchPattern
formattedpattern
argument by expanding the pattern and by adjusting the pattern to include the basename from thedocumentName
argument.protected String
modifyEntry
(DocumentName documentName, String entry) Allows modification of the file entry to match theMatchPattern
format.
-
Field Details
-
REGEX_FMT
A String format pattern to print a regex string- See Also:
-
EMPTY
An empty file processor returning no entries. -
NEGATION_PREFIX
Prefix used to negate the given pattern.- See Also:
-
customMatchers
The collection of custom DocumentNameMatchers generated by this processor
-
-
Constructor Details
-
FileProcessor
protected FileProcessor()Protected constructor. -
FileProcessor
Create a file processor out of a list of file patterns.- Parameters:
patterns
- the patterns to simulate the file from.
-
-
Method Details
-
apply
- Specified by:
apply
in interfaceFunction<DocumentName,
Iterable<String>>
-
customDocumentNameMatchers
If this FileProcessor builds custom matchers to handles special cases this method returns them to the processing stream.- Returns:
- A collection of DocumentNameMatchers. Default returns an empty list.
-
modifyEntry
Allows modification of the file entry to match theMatchPattern
format. Default implementation returns the @{code entry} argument.- Parameters:
documentName
- the name of the document that the file was read from.entry
- the entry from that document.- Returns:
- the modified string or null to skip the string.
-
localizePattern
Modifies theMatchPattern
formattedpattern
argument by expanding the pattern and by adjusting the pattern to include the basename from thedocumentName
argument.- Parameters:
documentName
- the name of the file being read.pattern
- the pattern to format.- Returns:
- the completely formatted pattern
-