Yes, could be. Is the super class mapped as well ? And did you use the extends="..." clause to express this inheritance ?
Werner Nick Pilch wrote: > Thanks for the tips. I see the benefits of using an object. However, I > am trying to implement my solution on top of existing code, so I need to > deal with the existing int variable. > > Previously my "field" looked like this "<field name="_duration" > type="integer" direct="true">". Removing the underscore, now I get "The > field duration in class ScheduleDefinition is not accessible -- the > field must be public, not static and not transient". I remember that > this error is why I added the underscore in the first place. > > Now, this variable is public and not transient and not static, but it > *is* declared in a superclass. Could that be the problem? > > At 4:56 PM +0100 3/3/07, Werner Guttmann wrote: >> 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 > > --------------------------------------------------------------------- To unsubscribe from this list please visit: http://xircles.codehaus.org/manage_email

