background image

Inline and External Customizations

<< Customizing JAXB Bindings | Inline Customizations >>
<< Customizing JAXB Bindings | Inline Customizations >>
36
U
SING
JAXB
· To resolve name collisions (as described in Appendix C.2.1 of the JAXB
Specification). Note that the JAXB binding compiler detects and reports
all name conflicts.
· To provide names for typesafe enumeration constants that are not legal
Java identifiers; for example, enumeration over integer values.
· To provide better names for the Java representation of unnamed model
groups when they are bound to a Java property or class.
· To provide more meaningful package names than can be derived by
default from the target namespace URI.
· Overriding default bindings; for example:
· Specify that a model group should be bound to a class rather than a list.
· Specify that a fixed attribute can be bound to a Java constant.
· Override the specified default binding of XML Schema built-in
datatypes to Java datatypes. In some cases, you might want to introduce
an alternative Java class that can represent additional characteristics of
the built-in XML Schema datatype.
Customization Overview
This section explains some core JAXB customization concepts:
· Inline and External Customizations
· Scope, Inheritance, and Precedence
· Customization Syntax
· Customization Namespace Prefix
Inline and External Customizations
Customizations to the default JAXB bindings are made in the form of binding
declarations
passed to the JAXB binding compiler. These binding declarations
can be made in either of two ways:
· As inline annotations in a source XML schema
· As declarations in an external binding customizations file
For some people, using inline customizations is easier because you can see your
customizations in the context of the schema to which they apply. Conversely,
using an external binding customization file enables you to customize JAXB