commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gary Gregory (JIRA)" <>
Subject [jira] Commented: (IO-119) Convenience "Builder" for creating complex FileFilter conditions
Date Mon, 11 Feb 2008 01:58:08 GMT


Gary Gregory commented on IO-119:

I know I am jumping in the middle here, but I must say that I do not agree with last comment.
Well, this style is optional since you do not have to cascade method invocations like this,
so I'm just stating this for discussion. 

IMO, an API should not be designed for typing convenience. When I think about code and its
life cycle, I think about clarity. I think code should express ideas as clearly as possible,
whether or not this expression is succinct does not matter to me. 

The amount of time spent by one person witting new code is minuscule compared the amount of
time that will be spent by many people over the months and years of that code's lifetime.
So I rarely use cascading method invocation, since it's never clear (unlike in Smalltalk)
who the receiver of the method really is. IDE code formatters also do not know that something
is a 'builder' and usually mess up all of that careful spacing.

> Convenience "Builder" for creating complex FileFilter conditions
> ----------------------------------------------------------------
>                 Key: IO-119
>                 URL:
>             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:,
> 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.

View raw message