public class PatternFileFilter extends AbstractPatternFilter<File> implements FileFilter
AbstractPatternFilter and FileFilter combination, using a set of Regular expressions to accept the canonical absolute paths to Files.
Modifier and Type | Field and Description |
---|---|
static StringConverter<File> |
FILE_PATH_CONVERTER
Converter returning the canonical and absolute path for a File.
|
static String |
PATTERN_LETTER_DIGIT_PUNCT
Java RegExp pattern matching one or more letters/digits/punctuation characters.
|
log, TOSTRING_INDENT
Constructor and Description |
---|
PatternFileFilter()
Creates 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.
|
Modifier and Type | Method and Description |
---|---|
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.
|
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.
|
convert, convert, onCandidate, onInitialize, setAcceptCandidateOnPatternMatch, setConverter, setPatternPrefix, setPatterns, toString
accept, addDelayedLogMessage, initialize, isInitialized, onNullCandidate, setProcessNullValues, validateDiSetterCalledBeforeInitialization
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
accept
public static final String PATTERN_LETTER_DIGIT_PUNCT
PATTERN_LETTER_DIGIT_PUNCT + "txt"
matches all file paths ending in "txt", such as "some/foobar.txt"PATTERN_LETTER_DIGIT_PUNCT +
"foobar" + PATTERN_LETTER_DIGIT_PUNCT
matches all file paths containing "foobar" such as
"the/file/in/directory/foobar/blah.java""/some/prefix"
+ PATTERN_LETTER_DIGIT_PUNCT
matches all file paths starting in "/some/prefix", such as
"some/prefix/another/specification.xsd"public static final StringConverter<File> FILE_PATH_CONVERTER
public PatternFileFilter(boolean processNullValues, String patternPrefix, List<String> patterns, StringConverter<File> converter, boolean acceptCandidateOnPatternMatch)
processNullValues
- if true
, this PatternFileFilter process null candidate values.patternPrefix
- a prefix to be prepended to any patterns submitted to
this PatternFileFilterpatterns
- The non-null list of Patters which should be applied within this
PatternFileFilter.converter
- The StringConverter which converts Files to Strings for Pattern matching.acceptCandidateOnPatternMatch
- if true
, this PatternFileFilter will matchAtLeastOnce
candidate objects that match at least one of the supplied patterns.
if false
, this PatternFileFilter will noFilterMatches
candidates that match at least one of the supplied patterns.public PatternFileFilter(List<String> patternStrings, boolean acceptCandidateOnPatternMatch)
PATTERN_LETTER_DIGIT_PUNCT
and compiled to Patterns).
The FILE_PATH_CONVERTER
is used to convert Files to strings.
The supplied acceptCandidateOnPatternMatch
parameter indicates if this
PatternFileFilter accepts or rejects candidates that match any of the supplied patternStrings.patternStrings
- The list of patternStrings to be used as file path suffixes.acceptCandidateOnPatternMatch
- if true
, this PatternFileFilter will matchAtLeastOnce
candidate objects that match at least one of the supplied patterns.
if false
, this PatternFileFilter will noFilterMatches
candidates that match at least one of the supplied patterns.FILE_PATH_CONVERTER
,
PATTERN_LETTER_DIGIT_PUNCT
,
AbstractPatternFilter.convert(java.util.List, String)
public PatternFileFilter(List<String> patterns)
PATTERN_LETTER_DIGIT_PUNCT
and compiled to Patterns).
The FILE_PATH_CONVERTER
is used to convert Files to strings.
The retrieved PatternFileFilter accepts candidates that match any of the supplied patternStrings.patterns
- The list of patternStrings to be used as file path suffixes.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 is
FILE_PATH_CONVERTER
and this PatternFileFilter does by default accept candidates that match any of
the supplied PatternStrings (i.e. an include-mode filter)
public static List<Filter<File>> createExcludeFilterList(org.apache.maven.plugin.logging.Log log, String... patterns)
PATTERN_LETTER_DIGIT_PUNCT
and compiled to
Patterns). The FILE_PATH_CONVERTER
is used to convert Files to strings.patterns
- A List of suffix patterns to be used in creating a new ExclusionRegularExpressionFileFilter.log
- The active Maven Log.PatternFileFilter
public static List<Filter<File>> createIncludeFilterList(org.apache.maven.plugin.logging.Log log, String... patterns)
PATTERN_LETTER_DIGIT_PUNCT
and compiled to
Patterns). The FILE_PATH_CONVERTER
is used to convert Files to strings.patterns
- A List of suffix patterns to be used in creating a new ExclusionRegularExpressionFileFilter.log
- The active Maven Log.PatternFileFilter
Copyright © 2005–2017 MojoHaus. All rights reserved.