Castor documentation states that if you don't have a noarg constructor which
castor requires, it's no problem since you can create a custom fieldhandler
with correct public Object newInstance(Object parent), which instantiates
your object.

http://www.castor.org/reference/html/XML%20data%20binding.html

I have this need as my class does not have a public noarg constructor.

1) OK, I can implement GeneralizedFieldHandler, but what if I don't want to
touch convertUponSet/Get. For example my noarg Color class would not be
marshalled into simple:

<color>blue</color>

and would instead be for example

<color>
  <red>FF</red>
  <green>FF</green>
  <blue>FF</blue>
  <alpha>FF</alpha>
</color>

and I don't want to implement to to parse / create the XML

2) How is this usable if I have a collection of fields (colors)? I tried
adding custom field handler to a collection like:

   <field name="color" type="mytest.Color" collection="collection"
handler="ColorHandler">
       <bind-xml name="colors" node="element" />
   </field>

but it had no effect

Or is this GeneralizedFieldHandler approach only applicable when using
simple fields that are mapped to strings?
-- 
View this message in context: 
http://old.nabble.com/No-constructor%2C-no-problem--tp26337595p26337595.html
Sent from the Castor - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to