commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephen Colebourne <scolebou...@btopenworld.com>
Subject Re: Expressions, Collections, Filtering oh my..
Date Tue, 05 Jul 2005 21:40:46 GMT
Poppe, Troy wrote:
> I've got a collection of a JavaBeans, it could be a plain-old-Java collection or
> a Commons-Collection... Not really a concern...
> 
> I'm trying to find a way to provide the ability to write a JEXL-like expression
> that would be applied against the collection of JavaBeans, and be able to
> retrieve all of the JavaBeans that match that JEXL-like expression.
> 
> So far, looking at JEXL, it looks like it requires a JexlContext, but I don't see
> or know how I would adapt my JavaBean properties to this.
> 
> Is there an out-of-the-binary way of filtering through my JavaBeans, and giving
> me access to those that match some expression?

With commons-collections, the best approach is to write a Predicate 
instance (typcially an inner class), and use CollectionUtils.filter or 
PredicateCollection to do the filtering. No specific JEXL handling though.

Stephen

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message