commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Goodwin <>
Subject [betwixt] object<->string conversion .betwixt file
Date Fri, 28 Jan 2005 19:35:46 GMT
I have been able to be able to write out a bean with a date to a format 
other than the default by specifying an options parameter and doing a 
quick hack
to the betwixt source.  Here is the .betwixt file.
<?xml version='1.0' ?>
  <element name='ActivitySummary'>
      <element name='CommissionsYTD' property='commissionsYTD'/>
      <element name='LastCommissionAmt' property='lastCommissionAmt'/>
      <element name='LastCommissionDate' property='lastCommissionDate'>
      <element name='PremiumYTD' property='premiumYTD'/>

I modded the source in the AbstractBeanWriter in the convertToString 
method by just simply checking of the existence of the option for 
object-string-converter and then instantiating the converter specified.  
Real ugly hack, but it works.  However, this does not work for string to
object conversion because digester just uses the objectStringConverter 
on the BindingConfiguration.  I've been trying to trace through and see 
the objectStringConverter is set on the BindingConfiguration and see 
what ways I can override this with the .betwixt file.  Does anyone see a 
way I can do this?  I'd like to be able to specify everything in the 
.betwixt file so I don't have to specify my converter in code, and also 
in case I need to use a different format for a different element (it 
appears that the converter when registering it will convert all elements 
of the type - in my case date - using the same converter).  Open to any 


p.s. If you see a better way to do the ObjectToString conversion besides 
my hack, please input that as well

Matt Goodwin
"Transcending the Ordinary"

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message