background image

Property Binding Declarations

<< Class Binding Declarations | MyDatatypeConverter Class >>
<< Class Binding Declarations | MyDatatypeConverter Class >>
C
USTOMIZE
I
NLINE
E
XAMPLE
53
</jxb:javadoc>
</jxb:class>
</xsd:appinfo>
</xsd:annotation>
Note: If you want to include HTML markup tags in a
<jaxb:javadoc>
customiza-
tion, you must enclose the data within a
CDATA
section or escape all left angle brack-
ets using
&lt;
. See XML 1.0 2nd Edition for more information (
http://
www.w3.org/TR/2000/REC-xml-20001006#sec-cdata-sect
).
Property Binding Declarations
Of particular interest here is the
generateIsSetMethod
customization, which
causes two additional property methods,
isSetQuantity
and
unsetQuantity
, to
be generated. These methods enable a client application to distinguish between
schema default values and values occurring explicitly within an instance docu-
ment.
For example, in
po.xsd
:
<xsd:complexType name="Items">
<xsd:sequence>
<xsd:element name="item" minOccurs="1"
maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="productName" type="xsd:string"/>
<xsd:element name="quantity" default="10">
<xsd:annotation>
<xsd:appinfo>
<jxb:property generateIsSetMethod="true"/>
</xsd:appinfo>
</xsd:annotation>
.
.
.
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
The
@generateIsSetMethod
applies to the
quantity
element, which is bound
to a property within the
Items.ItemType
interface.
unsetQuantity
and
isSetQuantity
methods are generated in the
Items.ItemType
interface.