Class PatternFileFilter
java.lang.Object
org.codehaus.mojo.jaxb2.shared.filters.AbstractFilter<File>
org.codehaus.mojo.jaxb2.shared.filters.pattern.AbstractPatternFilter<File>
org.codehaus.mojo.jaxb2.shared.filters.pattern.PatternFileFilter
- All Implemented Interfaces:
FileFilter
,Filter<File>
AbstractPatternFilter and FileFilter combination, using a set of Regular expressions to accept the canonical absolute paths to Files.
- Since:
- 2.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringConverter
<File> Converter returning the canonical and absolute path for a File.static final String
Java RegExp pattern matching one or more letters/digits/punctuation characters.Fields inherited from class org.codehaus.mojo.jaxb2.shared.filters.AbstractFilter
log, TOSTRING_INDENT
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new PatternFileFilter with no patternStrings List, implying that calling this constructor must be followed by a call to the#setPatterns
method.PatternFileFilter
(boolean processNullValues, String patternPrefix, List<String> patterns, StringConverter<File> converter, boolean acceptCandidateOnPatternMatch) Compound constructor creating an PatternFileFilter from the supplied parameters.PatternFileFilter
(List<String> patterns) Creates a new PatternFileFilter using the supplied patternStrings which are interpreted as file suffixes.PatternFileFilter
(List<String> patternStrings, boolean acceptCandidateOnPatternMatch) Creates a new PatternFileFilter using the supplied patternStrings which are interpreted as file suffixes. -
Method Summary
Modifier and TypeMethodDescriptioncreateExcludeFilterList
(org.apache.maven.plugin.logging.Log log, String... patterns) Creates a new List containing an exclude-mode PatternFileFilter using the supplied patternStrings which are interpreted as file suffixes.createFilterList
(org.apache.maven.plugin.logging.Log log, boolean includeOperation, String... patterns) createIncludeFilterList
(org.apache.maven.plugin.logging.Log log, String... patterns) Creates a new List containing an include-mode PatternFileFilter using the supplied patternStrings which are interpreted as file suffixes.Methods inherited from class org.codehaus.mojo.jaxb2.shared.filters.pattern.AbstractPatternFilter
convert, convert, onCandidate, onInitialize, setAcceptCandidateOnPatternMatch, setConverter, setPatternPrefix, setPatterns, toString
Methods inherited from class org.codehaus.mojo.jaxb2.shared.filters.AbstractFilter
accept, addDelayedLogMessage, initialize, isInitialized, onNullCandidate, setProcessNullValues, validateDiSetterCalledBeforeInitialization
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.io.FileFilter
accept
-
Field Details
-
PATTERN_LETTER_DIGIT_PUNCT
Java RegExp pattern matching one or more letters/digits/punctuation characters. It can be flexibly used to separate normative text in a pattern:- Pattern matching ends of strings.
PATTERN_LETTER_DIGIT_PUNCT + "txt"
matches all file paths ending in "txt", such as "some/foobar.txt" - Pattern matching strings containing patterns.
PATTERN_LETTER_DIGIT_PUNCT + "foobar" + PATTERN_LETTER_DIGIT_PUNCT
matches all file paths containing "foobar" such as "the/file/in/directory/foobar/blah.java" - Pattern matching start of strings.
"/some/prefix" + PATTERN_LETTER_DIGIT_PUNCT
matches all file paths starting in "/some/prefix", such as "some/prefix/another/specification.xsd"
- See Also:
- Pattern matching ends of strings.
-
FILE_PATH_CONVERTER
Converter returning the canonical and absolute path for a File.
-
-
Constructor Details
-
PatternFileFilter
Creates a new PatternFileFilter using the supplied patternStrings which are interpreted as file suffixes. (I.e. prepended withPATTERN_LETTER_DIGIT_PUNCT
and compiled to Patterns). TheFILE_PATH_CONVERTER
is used to convert Files to strings. The suppliedacceptCandidateOnPatternMatch
parameter indicates if this PatternFileFilter accepts or rejects candidates that match any of the supplied patternStrings.- Parameters:
patternStrings
- The list of patternStrings to be used as file path suffixes.acceptCandidateOnPatternMatch
- iftrue
, this PatternFileFilter will matchAtLeastOnce candidate objects that match at least one of the supplied patterns. iffalse
, this PatternFileFilter will noFilterMatches candidates that match at least one of the supplied patterns.- See Also:
-
PatternFileFilter
Creates a new PatternFileFilter using the supplied patternStrings which are interpreted as file suffixes. (I.e. prepended withPATTERN_LETTER_DIGIT_PUNCT
and compiled to Patterns). TheFILE_PATH_CONVERTER
is used to convert Files to strings. The retrieved PatternFileFilter accepts candidates that match any of the supplied patternStrings.- Parameters:
patterns
- The list of patternStrings to be used as file path suffixes.
-
PatternFileFilter
public PatternFileFilter()Creates a new PatternFileFilter with no patternStrings List, implying that calling this constructor must be followed by a call to the
#setPatterns
method.The default prefix is
PATTERN_LETTER_DIGIT_PUNCT
, the default StringConverter isFILE_PATH_CONVERTER
and this PatternFileFilter does by default accept candidates that match any of the supplied PatternStrings (i.e. an include-mode filter)
-
Method Details
-
createExcludeFilterList
public static List<Filter<File>> createExcludeFilterList(org.apache.maven.plugin.logging.Log log, String... patterns) Creates a new List containing an exclude-mode PatternFileFilter using the supplied patternStrings which are interpreted as file suffixes. (I.e. prepended withPATTERN_LETTER_DIGIT_PUNCT
and compiled to Patterns). TheFILE_PATH_CONVERTER
is used to convert Files to strings.- Parameters:
log
- The active Maven Log.patterns
- A List of suffix patterns to be used in creating a new ExclusionRegularExpressionFileFilter.- Returns:
- A List containing a PatternFileFilter using the supplied suffix patterns to match Files.
- See Also:
-
createIncludeFilterList
public static List<Filter<File>> createIncludeFilterList(org.apache.maven.plugin.logging.Log log, String... patterns) Creates a new List containing an include-mode PatternFileFilter using the supplied patternStrings which are interpreted as file suffixes. (I.e. prepended withPATTERN_LETTER_DIGIT_PUNCT
and compiled to Patterns). TheFILE_PATH_CONVERTER
is used to convert Files to strings.- Parameters:
log
- The active Maven Log.patterns
- A List of suffix patterns to be used in creating a new ExclusionRegularExpressionFileFilter.- Returns:
- A List containing a PatternFileFilter using the supplied suffix patterns to match Files.
- See Also:
-
createFilterList
-