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

Convenience "Builder" for creating complex FileFilter conditions

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Won't Fix
    • Affects Version/s: 1.3.1
    • Fix Version/s: None
    • Component/s: Filters
    • Labels:
      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. FileFilterBuilderTestCase.java
          56 kB
          Niall Pemberton
        2. FileFilterBuilder.java
          40 kB
          Niall Pemberton

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: