Uploaded image for project: 'Commons IO'
  1. Commons IO
  2. IO-119

Convenience "Builder" for creating complex FileFilter conditions

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Won't Fix
    • 1.3.1
    • None
    • Filters
    • None

    Description

      I'd like to add a new convenience "builder" class (FileFilterBuilder) to make it easier to create complex FileFilter using Commons IO's IOFileFilter implementations.

      Heres an example of how it can be used to create a IOFileFilter for the following conditions:

      • Either, directories which are not hidden and not named ".svn"
      • or, files which have a suffix of ".java"

      IOFileFilter filter = FileFilterBuilder.orBuilder()
      .and().isDirectory().isHidden(false).not().name(".svn").end()
      .and().isFile().suffix(".java").end()
      .getFileFilter();

      Attachments

        1. FileFilterBuilder.java
          40 kB
          Niall Pemberton
        2. FileFilterBuilderTestCase.java
          56 kB
          Niall Pemberton

        Activity

          People

            niallp Niall Pemberton
            niallp Niall Pemberton
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: