commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rune Toalango Johannesen" <>
Subject [BeanUtils] - Extensions for dotted queries...
Date Thu, 20 Mar 2003 15:00:51 GMT
Due to problems getting the previous email with some code through paranoid firewalls I try
again here... ;)

The original email:

[BeanUtils] - Extensions for dotted queries in composite data structures


Attached you find some classes that extends the functionality of the existing BeanUtils package;




The purpose of this extension is to allow bean property queries not only on pure beans, but
in composite data structures that might involve maps, lists, arrays and collections in addition
to the traditional beans.

The ObjectUtils lets you resolve dotted queries like this;

        String text = (String) ObjectUtils.get(namespace, "session.products.0.children.2.displayText");

as opposed to

        String text = (String) ((List) ((Catalog) namespace.get("session")).getProducts()).get(0)............

The NestedObjectUtils lets you do the same, but allows nested queries like;


The NestedObjectUtils depends on the Commons-Lang (org.apache.commons.lang.StringUtils) in
addition to the existing BeanUtils dependencies.

I've javadoc'ed the code and provided some unit tests... Let me know what you think - should
this be included in the BeanUtils package in some future release? What about extending it
to support the DynaBean concept? What about extending the query language in the BeanUtils
package in general to support both traditional () and [] delimiters in addition to the uniformed
dot - as it is used in these classes?



Sie haben mehr zu sagen als in eine SMS passt? Mit WEB.DE FreeMail ist
das jetzt kein Problem mehr!
View raw message