[
https://issues.apache.org/jira/browse/IO-119?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12567145#action_12567145
]
Jukka Zitting commented on IO-119:
----------------------------------
How about using the Factory pattern instead of Builder:
IOFileFilterFactory f = new IOFileFilterFactory();
f.or(
f.and(f.isDirectory(), f.not(f.isHidden()), f.not(f.name(".svn"))),
f.and(f.isFile(), f.suffix(".java")));
or if you can use static imports:
import static org.apache.commons.io.filefilter.IOFileFilterFactory.*;
or(
and(isDirectory(), not(isHidden()), not(name(".svn"))),
and(isFile(), suffix(".java")));
> Convenience "Builder" for creating complex FileFilter conditions
> ----------------------------------------------------------------
>
> Key: IO-119
> URL: https://issues.apache.org/jira/browse/IO-119
> Project: Commons IO
> Issue Type: Improvement
> Components: Filters
> Affects Versions: 1.3.1
> Reporter: Niall Pemberton
> Assignee: Niall Pemberton
> Priority: Minor
> Fix For: 2.x
>
> Attachments: FileFilterBuilder.java, FileFilterBuilderTestCase.java
>
>
> 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();
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.