Class IncludeExcludeFileSelector
java.lang.Object
org.codehaus.plexus.components.io.fileselectors.IncludeExcludeFileSelector
- All Implemented Interfaces:
FileSelector
This file selector uses a set of patterns for including/excluding
files.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final org.codehaus.plexus.util.MatchPatternsprivate org.codehaus.plexus.util.MatchPatternsprivate org.codehaus.plexus.util.MatchPatternsprivate String[]private String[]private booleanstatic final StringThe include/exclude file selectors role-hint: "standard".private booleanprivate static final org.codehaus.plexus.util.MatchPatterns -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate Stringprivate static StringgetCanonicalName(String pName) String[]Returns the list of exclude patterns to use.String[]Returns the list of include patterns to use.booleanReturns, whether the include/exclude patterns are case sensitive.protected booleanisExcluded(String name) Tests whether or not a name matches against at least one exclude pattern.protected booleanisIncluded(String name) Tests whether or not a name matches against at least one include pattern.booleanisSelected(FileInfo fileInfo) Returns, whether the given file is selected.booleanReturns, whether to use the default excludes, as specified byFileUtils.getDefaultExcludes().protected booleanTests, whether the given pattern is matching the given name.voidsetCaseSensitive(boolean caseSensitive) Sets, whether the include/exclude patterns are case sensitive.voidsetExcludes(String[] excludes) Sets the list of exclude patterns to use.voidsetIncludes(String[] includes) Sets the list of include patterns to use.voidsetUseDefaultExcludes(boolean pUseDefaultExcludes) Sets, whether to use the default excludes, as specified byFileUtils.getDefaultExcludes().
-
Field Details
-
ROLE_HINT
The include/exclude file selectors role-hint: "standard".- See Also:
-
ALL_INCLUDES
private static final org.codehaus.plexus.util.MatchPatterns ALL_INCLUDES -
ZERO_EXCLUDES
private static final org.codehaus.plexus.util.MatchPatterns ZERO_EXCLUDES -
isCaseSensitive
private boolean isCaseSensitive -
useDefaultExcludes
private boolean useDefaultExcludes -
includes
-
excludes
-
computedIncludes
private org.codehaus.plexus.util.MatchPatterns computedIncludes -
computedExcludes
private org.codehaus.plexus.util.MatchPatterns computedExcludes
-
-
Constructor Details
-
IncludeExcludeFileSelector
public IncludeExcludeFileSelector()
-
-
Method Details
-
isExcluded
Tests whether or not a name matches against at least one exclude pattern.- Parameters:
name- The name to match. Must not benull.- Returns:
truewhen the name matches against at least one exclude pattern, orfalseotherwise.
-
setIncludes
Sets the list of include patterns to use. All '/' and '\' characters are replaced byFile.separatorChar, so the separator used need not matchFile.separatorChar.When a pattern ends with a '/' or '\', "**" is appended.
- Parameters:
includes- A list of include patterns. May benull, indicating that all files should be included. If a non-nulllist is given, all elements must be non-null.
-
getCanonicalName
-
asPattern
-
getIncludes
Returns the list of include patterns to use.- Returns:
- A list of include patterns.
May be
null, indicating that all files should be included. If a non-nulllist is given, all elements must be non-null.
-
setExcludes
Sets the list of exclude patterns to use. All '/' and '\' characters are replaced byFile.separatorChar, so the separator used need not matchFile.separatorChar.When a pattern ends with a '/' or '\', "**" is appended.
- Parameters:
excludes- A list of exclude patterns. May benull, indicating that no files should be excluded. If a non-nulllist is given, all elements must be non-null.
-
getExcludes
Returns the list of exclude patterns to use.- Returns:
- A list of exclude patterns.
May be
null, indicating that no files should be excluded. If a non-nulllist is given, all elements must be non-null.
-
matchPath
Tests, whether the given pattern is matching the given name.- Parameters:
pattern- The pattern to matchname- The name to testisCaseSensitive- Whether the pattern is case sensitive.- Returns:
- True, if the pattern matches, otherwise false
-
isIncluded
Tests whether or not a name matches against at least one include pattern.- Parameters:
name- The name to match. Must not benull.- Returns:
truewhen the name matches against at least one include pattern, orfalseotherwise.
-
isSelected
Description copied from interface:FileSelectorReturns, whether the given file is selected.- Specified by:
isSelectedin interfaceFileSelector- Parameters:
fileInfo- An instance of FileInfo with the files meta data. It is recommended, that the caller creates an instance ofPlexusIoResource.
-
isCaseSensitive
public boolean isCaseSensitive()Returns, whether the include/exclude patterns are case sensitive.- Returns:
- True, if the patterns are case sensitive (default), or false.
-
setCaseSensitive
public void setCaseSensitive(boolean caseSensitive) Sets, whether the include/exclude patterns are case sensitive.- Parameters:
caseSensitive- True, if the patterns are case sensitive (default), or false.
-
isUseDefaultExcludes
public boolean isUseDefaultExcludes()Returns, whether to use the default excludes, as specified byFileUtils.getDefaultExcludes(). -
setUseDefaultExcludes
public void setUseDefaultExcludes(boolean pUseDefaultExcludes) Sets, whether to use the default excludes, as specified byFileUtils.getDefaultExcludes().
-