Hi Lars,

Currently the has method needs to have the same name as the field name
you give in the mapping file. So if you mapping looks like this:

<field name="foo" ../>

Then Castor will automatically look for "hasFoo" as the has-method.

There is currently no has-method attribute for specify which has-method
to use, but this is something that can be added.

The best thing to do is to open an enhancement request at
http://bugzilla.exolab.org 

Thanks,

--Keith

> Lars Lindgren wrote:
> 
> Hi!
> 
> I sent this mail a while ago, but I didn't get an answer so I'll give
> it another try.
> 
> I have discovered that if I have a field defined as the following:
> 
> <field name="offset" type="long" get-method="getOffset"
> set-method="setOffset" />
> 
> the method hasOffset() is used to check if offset is defined, but if I
> have the following definition:
> 
> <field name="m_offset" type="long" get-method="getOffset"
> set-method="setOffset" />
> 
> the method getOffset is used to check if the offset is set.
> 
> My question is now if it is possible to select which has-method to
> use?
> 
> If it is not, why is there no such possibility. Normally the
> has-method tells if the value that
> the get-method returns is valid. If e.g. the field is of type long
> there is no way to check if
> that value is valid using the getMethod, because there is no null
> value.
> 
> So if I have a variable "offset" (long) and a variable "hasOffset"
> (boolean), where the last one is
> returned by hasOffset() and tells if the offset value is valid, I can
> control if the value shall be
> saved to the XML file. But if I change the name of the offset variable
> the hasOffset value and
> the hasOffset() method is neglected, and the offset value is treated
> as if it is always a valid
> value no matter what the hasOffset value is.
> 
> Would really appreciate some help with this!
> 
> Best regards
> Lars

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to