Hi Toby,

yes, you can either use direct access to fields (which have to be public
field definitions, though), or specify a custom setter method on the
field mapping, e.g.

<field name="foo" type="Foo" set-method="addFoo" ge-method="getFoo">
   <bind-xml .... />
</field>

I hope this helps.

Regards
Werner

Toby wrote:
> Cheers, I kind of thought so just wanted to get a professionals opinion :D
> 
> I guess when using a mapping file I should set direct=true?
> 
> ta
> 
> 2008/8/3 Werner Guttmann <[EMAIL PROTECTED]>
> 
>> Hi Toby,
>>
>> I guess you will have to use a mapping file and define a setter/adder
>> method to avoid that (particular) problem.
>>
>> Werner
>>
>> Toby wrote:
>>> Hi folks,
>>>
>>> Just a quick one, does anyone have any tips about
>> marshalling/unmarshalling
>>> immutable objects? I'm not using a mapping file (at the moment) and
>>> discovered when one of my classes is unmarshalled (it marshals ok), it
>> uses
>>> the getter to get a collection then adds to it and so "re-loads" the
>> object
>>> from the XML. However, my immutable object guards against such
>> modification
>>> (its immutable) and so it returns a copy of the collection (so any adds
>> to
>>> it wont really count).
>>>
>>> I understood from the docs that if no getter is provided it'll try and
>> use
>>> the field/direct access, is that right? Otherwise, I guess my options are
>> to
>>> use a mapping file and control things better? I kinda like the default
>>> behaviour though ;)
>>>
>>> Cheers
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>    http://xircles.codehaus.org/manage_email
>>
>>
>>
> 
> 

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

    http://xircles.codehaus.org/manage_email


Reply via email to