background image

Global Binding Declarations

<< Customize Inline Example | Schema Binding Declarations >>
<< Customize Inline Example | Schema Binding Declarations >>

Global Binding Declarations

3. Select the inline-customize folder.
4. Select the Open as Main Project check box.
5. Click Open Project Folder.
6. Right-click the inline-customize project and select Run Project.
Building and Running the Customize Inline Example Using Ant
To compile and run the Customize Inline example using Ant, in a terminal window, go to the
tut-install/javaeetutorial5/examples/jaxb/inline-customize/ directory and type the
following:
ant runapp
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
tut-install/javaeetutorial5/examples/jaxb/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 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, whichever is more appropriate.
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
.
Customizing JAXB Bindings
Chapter 17 · Binding between XML Schema and Java Classes
527