background image

Global Binding Declarations

<< Customize Inline Example | Schema Binding Declarations >>
<< Customize Inline Example | Schema Binding Declarations >>
50
U
SING
JAXB
3.
Main.java
is the primary class file in the Customize Inline example, which
uses the schema-derived classes generated by the JAXB compiler.
Key customizations in this sample, and the custom
MyDatatypeConverter.java
class, are described in more detail below.
Customized Schema
The customized schema used in the Customize Inline example is in the file
<JAVA_HOME>/jaxb/samples/inline-customize/po.xsd
. The customizations
are in the
<xsd:annotation>
tags.
Global Binding Declarations
The code below shows the
globalBindings
declarations in
po.xsd
:
<jxb:globalBindings
fixedAttributeAsConstantProperty="true"
collectionType="java.util.Vector"
typesafeEnumBase="xsd:NCName"
choiceContentProperty="false"
typesafeEnumMemberName="generateError"
bindingStyle="elementBinding"
enableFailFastCheck="false"
generateIsSetMethod="false"
underscoreBinding="asCharInWord"/>
In this example, all values are set to the defaults except for
collectionType
.
· Setting
collectionType
to
java.util.Vector
specifies that all lists in
the generated implementation classes should be represented internally as
vectors. Note that the class name you specify for
collectionType
must
implement
java.util.List
and be callable by
newInstance
.
· Setting
fixedAttributeAsConstantProperty
to true indicates that all
fixed attributes should be bound to Java constants. By default, fixed
attributes are just mapped to either simple or collection property, which
ever is more appropriate.
· Please note that the JAXB implementation does not support the
enable-
FailFastCheck
attribute.
· If
typesafeEnumBase
to
xsd:string
it would be a global way to specify
that all
simple
type definitions deriving directly or indirectly from