Package org.owasp.dependencycheck.utils
Class FileFilterBuilder
- java.lang.Object
-
- org.owasp.dependencycheck.utils.FileFilterBuilder
-
@NotThreadSafe public class FileFilterBuilder extends java.lang.ObjectUtility class for building useful
FileFilterinstances forAbstractFileTypeAnalyzerimplementations. The built filter usesOrFileFilterto logically OR the given filter conditions. Example usage:FileFilter filter = FileFilterBuilder.newInstance().addExtensions("jar", "war").build();- Author:
- Dale Visser
- See Also:
- Builder pattern
-
-
Constructor Summary
Constructors Constructor Description FileFilterBuilder()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description FileFilterBuilderaddExtensions(java.lang.Iterable<java.lang.String> extensions)Add to the set of file extensions to accept for analysis.FileFilterBuilderaddExtensions(java.lang.String... extensions)Add to the set of file extensions to accept for analysis.FileFilterBuilderaddFileFilters(org.apache.commons.io.filefilter.IOFileFilter... filters)Add to a list ofIOFileFilterinstances to consult for whether to accept a file for analysis.FileFilterBuilderaddFilenames(java.lang.String... names)Add to the set of filenames to accept for analysis.java.io.FileFilterbuild()Builds the filter and returns it.static FileFilterBuildernewInstance()Create a new instance and return it.
-
-
-
Method Detail
-
newInstance
public static FileFilterBuilder newInstance()
Create a new instance and return it. This method is for convenience in using the builder pattern within a single statement.- Returns:
- a new builder instance
-
addFilenames
public FileFilterBuilder addFilenames(java.lang.String... names)
Add to the set of filenames to accept for analysis. Case-sensitivity is assumed.- Parameters:
names- one or more filenames to accept for analysis- Returns:
- this builder
-
addExtensions
public FileFilterBuilder addExtensions(java.lang.String... extensions)
Add to the set of file extensions to accept for analysis. Case-insensitivity is assumed.- Parameters:
extensions- one or more file extensions to accept for analysis- Returns:
- this builder
-
addExtensions
public FileFilterBuilder addExtensions(java.lang.Iterable<java.lang.String> extensions)
Add to the set of file extensions to accept for analysis. Case-insensitivity is assumed.- Parameters:
extensions- one or more file extensions to accept for analysis- Returns:
- this builder
-
addFileFilters
public FileFilterBuilder addFileFilters(org.apache.commons.io.filefilter.IOFileFilter... filters)
Add to a list ofIOFileFilterinstances to consult for whether to accept a file for analysis.- Parameters:
filters- one or more file filters to consult for whether to accept for analysis- Returns:
- this builder
-
build
public java.io.FileFilter build()
Builds the filter and returns it.- Returns:
- a filter that is the logical OR of all the conditions provided by the add... methods
- Throws:
java.lang.IllegalStateException- if no add... method has been called with one or more arguments
-
-