commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Kitching <>
Subject Re: [betwixt] Reading and writing objects without using getters/setters
Date Sat, 02 Sep 2006 03:41:14 GMT
Hi Ryan,

On Wed, 2006-08-30 at 18:01 -0500, Ryan wrote:
> I would like to use betwixt to read and write objects from a 3rd party
> java library. Unfortunately the naming conventions used in some of
> these objects don't conform to the getter/setter properties that
> betwixt likes. Here are a few of the problems I need to address:
> 1. There is a class called Money which is backed by a BigDecimal that
> is accessible using the method asBigDecimal(). The object can be
> recreated using new Money(oldMoney.asBigDecimal()). Is there a way to
> tell betwixt/digestor to do the conversion by using that conversion to
> BigDecimal?

Sorry, don't know.

> 2. The setter methods on each of the objects return themselves instead
> of void. This appears to cause betwixt to believe the properties are
> readable but not writable. It looks like I can subclass
> XMLIntrospector so that I can modify the BeanInfo object before it is
> cached so that it knows about the writer methods, is this the best way
> to go about it?

If you have methods that don't obey the java properties spec, but want
software to treat them as properties, then the standard solution is to
write a BeanInfo class.

public class MoneyBeanInfo extends SimpleBeanInfo {



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

View raw message