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
Guys,
Attached you find some classes that extends the functionality of the existing
BeanUtils package;
ObjectUtils
and
NestedObjectUtils
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;
"session.products.0.children.{request.parameter.childNumber}.displayText"
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?
<<beanutils-extension.zip>>
Cheers,
Rune
______________________________________________________________________________
Sie haben mehr zu sagen als in eine SMS passt? Mit WEB.DE FreeMail ist
das jetzt kein Problem mehr! http://freemail.web.de/features/?mc=021182
beanutils-extension.zip
Description: Zip compressed data
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
