Class PatternFileFilter
- java.lang.Object
-
- org.codehaus.mojo.jaxb2.shared.filters.AbstractFilter<T>
-
- org.codehaus.mojo.jaxb2.shared.filters.pattern.AbstractPatternFilter<java.io.File>
-
- org.codehaus.mojo.jaxb2.shared.filters.pattern.PatternFileFilter
-
- All Implemented Interfaces:
java.io.FileFilter
,Filter<java.io.File>
public class PatternFileFilter extends AbstractPatternFilter<java.io.File> implements java.io.FileFilter
AbstractPatternFilter and FileFilter combination, using a set of Regular expressions to accept the canonical absolute paths to Files.
- Since:
- 2.0
-
-
Field Summary
Fields Modifier and Type Field Description static StringConverter<java.io.File>
FILE_PATH_CONVERTER
Converter returning the canonical and absolute path for a File.static java.lang.String
PATTERN_LETTER_DIGIT_PUNCT
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
Constructors Constructor 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, java.lang.String patternPrefix, java.util.List<java.lang.String> patterns, StringConverter<java.io.File> converter, boolean acceptCandidateOnPatternMatch)
Compound constructor creating an PatternFileFilter from the supplied parameters.PatternFileFilter(java.util.List<java.lang.String> patterns)
Creates a new PatternFileFilter using the supplied patternStrings which are interpreted as file suffixes.PatternFileFilter(java.util.List<java.lang.String> patternStrings, boolean acceptCandidateOnPatternMatch)
Creates a new PatternFileFilter using the supplied patternStrings which are interpreted as file suffixes.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.List<Filter<java.io.File>>
createExcludeFilterList(org.apache.maven.plugin.logging.Log log, java.lang.String... patterns)
Creates a new List containing an exclude-mode PatternFileFilter using the supplied patternStrings which are interpreted as file suffixes.private static java.util.List<Filter<java.io.File>>
createFilterList(org.apache.maven.plugin.logging.Log log, boolean includeOperation, java.lang.String... patterns)
static java.util.List<Filter<java.io.File>>
createIncludeFilterList(org.apache.maven.plugin.logging.Log log, java.lang.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
-
-
-
-
Field Detail
-
PATTERN_LETTER_DIGIT_PUNCT
public static final java.lang.String 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:
- Constant Field Values
- Pattern matching ends of strings.
-
FILE_PATH_CONVERTER
public static final StringConverter<java.io.File> FILE_PATH_CONVERTER
Converter returning the canonical and absolute path for a File.
-
-
Constructor Detail
-
PatternFileFilter
public PatternFileFilter(boolean processNullValues, java.lang.String patternPrefix, java.util.List<java.lang.String> patterns, StringConverter<java.io.File> converter, boolean acceptCandidateOnPatternMatch)
Compound constructor creating an PatternFileFilter from the supplied parameters.- Parameters:
processNullValues
- iftrue
, 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
- 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.
-
PatternFileFilter
public PatternFileFilter(java.util.List<java.lang.String> patternStrings, boolean acceptCandidateOnPatternMatch)
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:
FILE_PATH_CONVERTER
,PATTERN_LETTER_DIGIT_PUNCT
,AbstractPatternFilter.convert(java.util.List, String)
-
PatternFileFilter
public PatternFileFilter(java.util.List<java.lang.String> patterns)
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 Detail
-
createExcludeFilterList
public static java.util.List<Filter<java.io.File>> createExcludeFilterList(org.apache.maven.plugin.logging.Log log, java.lang.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:
patterns
- A List of suffix patterns to be used in creating a new ExclusionRegularExpressionFileFilter.log
- The active Maven Log.- Returns:
- A List containing a PatternFileFilter using the supplied suffix patterns to match Files.
- See Also:
PatternFileFilter
-
createIncludeFilterList
public static java.util.List<Filter<java.io.File>> createIncludeFilterList(org.apache.maven.plugin.logging.Log log, java.lang.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:
patterns
- A List of suffix patterns to be used in creating a new ExclusionRegularExpressionFileFilter.log
- The active Maven Log.- Returns:
- A List containing a PatternFileFilter using the supplied suffix patterns to match Files.
- See Also:
PatternFileFilter
-
createFilterList
private static java.util.List<Filter<java.io.File>> createFilterList(org.apache.maven.plugin.logging.Log log, boolean includeOperation, java.lang.String... patterns)
-
-