Nick,

yes, Castor can definitely deal with 'int' as well as many other types
during (un)marshalling. Please bear in mind that it's your choice
whether to make the instance variable (_duration in your case) of type
'int' or 'java.lang.Integer'. It all depends on your needs, whether
there's actually a requirement to express the fact that a value has not
been assigned yet (which would mandate the use of 'java.lang.Integer',
as null would be a valid value), etc.

But when mapping this instance variable in a mapping file, it's not
relevant anymore, as you'd map the _duration member as follows:

<field name="duration" type="integer">
   <xml-bind ... />
</field>

I hope this helps.
Werner

Nick Pilch wrote:
> I am using 1.0.5. I am following the example in
> http://castor.org/xml-mapping.html and it seems to indicate that castor
> can set the value of an int instance variable when unmarshalling. See
> the "_quantity" variable on that web page. However, when I try something
> like this (with a mapping file), I get the error in the subject line of
> this email:
> 
> "Type conversion error: could not set value of _duration(int) with value
> of type java.lang.Integer"
> 
> Is the documentation wrong? Do I need to use an instance variable of
> type Integer or a method taking an Integer parameter instead?
> 
> Thanks.


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

    http://xircles.codehaus.org/manage_email

Reply via email to