background image

Why Customize

<< Customizing JAXB Bindings | Inline and External Customizations >>
<< Customizing JAXB Bindings | Inline and External Customizations >>

Why Customize

Why Customize?
In most cases, the default bindings generated by the JAXB binding compiler will be sufficient to
meet your needs. There are cases, however, in which you might want to modify the default
bindings. Some of these include:
Creating API documentation for the schema-derived JAXB packages, classes, methods and
constants; by adding custom Javadoc tool annotations to your schemas, you can explain
concepts, guidelines, and rules specific to your implementation.
Providing semantically meaningful customized names for cases that the default XML
name-to-Java identifier mapping cannot handle automatically; for example:
To resolve name collisions (as described in Appendix D.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 data types to Java data
types. In some cases, you might want to introduce an alternative Java class that can
represent additional characteristics of the built-in XML Schema data type.
Customization Overview
This section explains some core JAXB customization concepts:
Inline and external customizations
Scope, inheritance, and precedence
Customization syntax
Customization namespace prefix
Customizing JAXB Bindings
Chapter 17 · Binding between XML Schema and Java Classes
515