commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From George Jempty <jemptymet...@acm.org>
Subject Need easy way to force all DynaBean property names to lower case
Date Wed, 02 Sep 2009 23:08:00 GMT
I'm developing functionality that can operate on concrete data beans
returned via Hibernate, or DynaBeans returned by using Jakarta
Commons/BeanUtils' RowSetDynaClass (which wraps a JDBC result set).
RowSetDynaClass by default forces all bean property names to lower case, and
I need to convert all my concrete beans from Hibernate to DynaBeans using
WrapDynaBean. The default lower casing by RowSetDynaClass seems like a good
idea, however I may not know ahead of time how the property names of the
concrete beans will be cased; due to Hibernate configuration, they need not
be cased identically to their corresponding table column names.

Is there built in functionality for forcing property names to lower case
using BeanUtils? I can't find it documented other than for RowSetDynaClass.
In lieu of something built in to BeanUtils, can anybody suggest the best way
to acheive this myself?

The above is verbatim from
http://stackoverflow.com/questions/1369915/need-easy-way-to-force-all-dynabean-property-names-to-lower-case
you
can answer there too if you want to accrue some reputation.

I've investigated this a bit more and it looks like I might be able to use
getMap() and then deal with the case of the string keys.  Doesn't seem
especially elegant though but I've only scratched the surface of the API.
 Is extending WrapDynaBean class and overriding introspect() a possibility?
 Finally, might a patch be in order to add this functionality to
WrapDynaBean/Class?  It seems like it could be more useful/inter-operable if
it behaved in a similar way to RowSetDynaClass, with an option (not the
default though) for forcing property names to lower case.
Thanks in advance
-- 
"Knowledge is of two kinds. We know a subject ourselves, or we know where we
can find information upon it." -- Samuel Johnson

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message