Hi,
I apologize for entering this thread several months late, but
I have a question I didn't see answered.
The hasXXX methods are effectively "dirty" bits, right? So
for primitives you can tell if a field has been set by calling
its has method... and for Objects you can see if it's been set
by checking if it's null. Is this correct?
If so, my point is, wouldn't it be better to have a uniform
interface and give all fields the hasXXX method? That was any
code that uses this value object doesn't have to know whether
it is a primitve or complex type.
I guess this would increase the size of the object but it
seems more object-oriented. Maybe it could be a command-line
option?
Let me know what you think...
Manish
PS So far Castor's been great, very nice to finally have a
tool like this!
>* From: Keith Visco
>* Subject: Re: [castor-dev] what type of class members
>* generate "has<varname>()" methods?
>* Date: Tue, 04 Sep 2001 12:45:40 -0700
>
>
>Robert,
>
>has-methods are generated for primitive types. Since you
>cannot have a null primitive type, there is no way to
>determine if the value was set explicitly or is simply the
>default value. Since there is often the need to check whether
>or not a value was set explicitly, we introduced the
>has-methods.
>
>Hope that helps your understanding...
>
>--Keith
>
>Robert Ollila wrote:
>> > Hi,
>> > Can anyone tell me under what circumstances the XML source
>> > generator creates
>> the "has<varname>()" method for a particular class member
>> variable. For
>> example, the sample invoice.xsd in the SourceGenerator
>> directory results in
>> an Item class with members as follows:
>> > private boolean _inStock = false;
>> > /**
>> * keeps track of state for field: _inStock
>> **/
>> private boolean _has_inStock;
>> > private java.lang.String _category;
>> > private java.lang.String _id;
>> > private int _quantity;
>> > /**
>> * keeps track of state for field: _quantity
>> **/
>> private boolean _has_quantity;
>> > private java.math.BigDecimal _price;
>> > Why do only members _inStock and _quantity have
>> > corresponding _has_XXX()
>> methods? What are they used for anyways?
>> > Any input would be appreciated,
>> > Bob.
>> > =================================
>> Robert G. Ollila
>> Software Engineer
>> METRObility Optical Systems, Inc.
>> 25 Manchester Street
>> Merrimack, NH 03054
>> Email: [EMAIL PROTECTED]
>> Phone: 603-589-0669
>> =================================
>> > -----------------------------------------------------------
>> If you wish to unsubscribe from this mailing, send mail to
>> [EMAIL PROTECTED] with a subject of:
>> unsubscribe castor-dev
>
>-----------------------------------------------------------
>If you wish to unsubscribe from this mailing, send mail to
>[EMAIL PROTECTED] with a subject of:
> unsubscribe castor-dev
--
Manish J. Bhatt Tel: 805.544.1089x2240
COM DEV Broadband Fax: 805.544.2055
http://www.comdev.cc Ham: kg6ede
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev