commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel McAllansmith <dani...@kiwiplan.co.nz>
Subject [betwixt] 1.0 beta dev Object <-> String conversion
Date Thu, 04 Sep 2003 00:13:03 GMT
Hello all,

the ability to do custom Object<->String conversion  provided in the beta 
looks really useful, unfortunately I'm having some trouble getting it 
working...

Given a bean class, TestBean, with getLocale() and setLocale(Locale) methods I 
thought it would be sufficient to add
beanWriter.getBindingConfiguration().setObjectStringConverter(new 
LocaleConverter())
before writing out the TestBean instance to get my LocaleConverter used.

This doesn't seem to be the case.
LocaleConverter.objectToString(..) is not called.
However if I add getName() setName(String) to TestBean then LocaleConverter is 
called upon to convert the name (but still not the locale).
(BTW: LocaleConverter has nothing to do with the one in beanutils.)

Digging through the code it seems that I can hack XmlHelperUtils to change 
what types are considered as primitives so that an ElementDescriptor is not 
created and the converter is used instead.  This seems a bit dodgy for Locale 
and _real_ dodgy for non java classes.

Am I blind?  Is there a better way?

Thanks
Daniel

---------------------------------------------------------------------
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