Return-Path: Delivered-To: apmail-commons-issues-archive@locus.apache.org Received: (qmail 92843 invoked from network); 24 Oct 2008 11:28:36 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 24 Oct 2008 11:28:36 -0000 Received: (qmail 50973 invoked by uid 500); 24 Oct 2008 11:28:38 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 50897 invoked by uid 500); 24 Oct 2008 11:28:38 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 50886 invoked by uid 99); 24 Oct 2008 11:28:38 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Oct 2008 04:28:38 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Oct 2008 11:27:35 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 43B80234C233 for ; Fri, 24 Oct 2008 04:27:44 -0700 (PDT) Message-ID: <1860926643.1224847664276.JavaMail.jira@brutus> Date: Fri, 24 Oct 2008 04:27:44 -0700 (PDT) From: "Anil K.Kinge (JIRA)" To: issues@commons.apache.org Subject: [jira] Updated: (COLLECTIONS-305) functors filtering on bean properties using(== ,!=, >,>=.>.>=. isNull, Like,..... ) In-Reply-To: <1619489719.1224831944230.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/COLLECTIONS-305?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Anil K.Kinge updated COLLECTIONS-305: ------------------------------------- Attachment: functors.propertypredicates.new.diff > functors filtering on bean properties using(== ,!=, >,>=.>.>=. isNull, Like,..... ) > ------------------------------------------------------------------------------------- > > Key: COLLECTIONS-305 > URL: https://issues.apache.org/jira/browse/COLLECTIONS-305 > Project: Commons Collections > Issue Type: Improvement > Components: Functor > Affects Versions: 3.4 > Reporter: Anil K.Kinge > Fix For: 3.4 > > Attachments: functors.propertypredicates.new.diff > > > In my current project I created a set of new Predicates that I call as Property Predicates. These predicates can used to filter a collection based on property values. > For example we have : > Class Foo{ > String name; > Int age; > Address address; > } > Address{ > String street; > String zip; > } > Collection myFoos ; > And we want to find all the Foo in myFoos with name that starts with A, and age > 40 and who are living at Zip 07095 we can create a Predicate like follows: > Predicate p = new PropertyLikePredicate("name","A*") > .andGreaterThan("age",40) > .andEquals(address.zip,"07095"); > Note: Like supports wildcards '*' and '?' > What is even better is that these predicates work with collections too. What I mean is if we have : > FooBar{ > String name; > Collection
addresses; > } > And you want to locate someone with a zip 07095 as part of anyof its' addresses all we need is to create a predicate : > Predicate p = new PropertyEqualsPredicate("addresses[].zip","07095"); > My Predicate chain currently supports the following features: > 1. andEquals > 2. orEquals > 3. andNotEquals > 4. orNotEquals > 5. andLike > 6. orLike > 7. andGreatorThan > 8. orGreatorThan > 9. andGreatorThanOrEquals > 10. orGreatorThanOrEquals > 11. andLessThan > 12. orLessThan > 13. andLessThanOrEquals > 14. orLessThanOrEquals > 15. isNull > 16. isNotNull > 17. orNull > 18. orNotNull > 19. orNullOrEmpty > 20. orNotNullOrEmpty > 21. andNullOrEmpty > 22. andNotNullOrEmpty > All features have accompanying testcases. In my opinion this is a powerful addition to the functors and I would like to contribute this work to the commons-collection. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.