Thanks Keith!,

That definately makes sense.

Bob.

-----Original Message-----
From: Keith Visco [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, September 04, 2001 4:11 PM
To: [EMAIL PROTECTED]
Subject: Re: [castor-dev] what type of class members generate
"has<varname>()" methods?




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

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

Reply via email to