For integer, decimal, and date fields I need to unmarshall from XML when the
value is empty string (""). For example:

<SomeTag someAttr="" />

The problem is, if I define the field as an "integer", "big-decimal" or
"date" type in my castor mapping xml, it will choke on the empty string
value when trying to convert it during the unmarshall. So I need a way to
treat (or convert) empty string as null.

For the integer/decimal field types, I was able to write my own FieldHandler
class to do this, because converting from String to Integer/BigDecimal is
not complicated. However, for date fields I don't want to duplicate all the
date-parsing code that Castor has in DateFieldHandler. I tried extending
DateFieldHandler, but so far this hasn't worked for me (need a concrete
FieldHandler implementation to pass to parent constructor).

Any suggestions?

Steve

Reply via email to