"EXT-Patel, Rajesh M" wrote:
>
> I have the following schema that defines a complex type,
> I would like to take the following WSDL:
>
> <xsd:complexType name="changeType">
> <xsd:sequence>
> <xsd:element name="dollar" type="xsd:float"/>
> <xsd:element name="percent" type="xsd:float"/>
> <xsd:element name="positive" type="xsd:boolean"/>
> </xsd:sequence>
> </xsd:complexType>
>
> And create java POJO, what the SourceGenerator does
> is it creates a ChangeType abstract class and a Change class
> which subclasses that. Why is this necessary?
>
> Also, it adds methods that keep track of whether or
> the the fields actually have a value, for example:
> public boolean hasPercent()
>
> Why does it need to do all this, why can it just create a
> simple java bean object with no superclass and not hasXXX
> methods?
Since all primitive types have a default value (int = 0, float = 0.0,
boolean = false), etc, there is no way to determine if the default value
has actually been set by the user or simply initialized by the JVM. The
"has" methods are used to differente between the two. Obviously these
has methods are not generated for objects since a comparison with null
can be used to determine whether the object has a "real" value.
As far as the class being abstract. An XML instance document can't be
based on just a complexType, an element must exist that has been
declared to be of that type in order for the instance to be valid.
--Keith
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-user