Example usage for org.apache.commons.io.filefilter OrFileFilter addFileFilter

List of usage examples for org.apache.commons.io.filefilter OrFileFilter addFileFilter

Introduction

In this page you can find the example usage for org.apache.commons.io.filefilter OrFileFilter addFileFilter.

Prototype

public void addFileFilter(final IOFileFilter ioFileFilter) 

Source Link

Usage

From source file:org.owasp.dependencycheck.utils.FileFilterBuilder.java

/**
 * Builds the filter and returns it./*from   w w w  .  j a v a  2  s  .  c o  m*/
 *
 * @return a filter that is the logical OR of all the conditions provided by the add... methods
 * @throws IllegalStateException if no add... method has been called with one or more arguments
 */
public FileFilter build() {
    if (filenames.isEmpty() && extensions.isEmpty() && fileFilters.isEmpty()) {
        throw new IllegalStateException(
                "May only be invoked after at least one add... method has been invoked.");
    }
    final OrFileFilter filter = new OrFileFilter();
    if (!filenames.isEmpty()) {
        filter.addFileFilter(new NameFileFilter(new ArrayList<String>(filenames)));
    }
    if (!extensions.isEmpty()) {
        filter.addFileFilter(new SuffixFileFilter(new ArrayList<String>(extensions), IOCase.INSENSITIVE));
    }
    for (IOFileFilter iof : fileFilters) {
        filter.addFileFilter(iof);
    }
    return filter;
}