10.12.2012 Views

The Java EE 5 Tutorial (PDF) - Oracle Software Downloads

The Java EE 5 Tutorial (PDF) - Oracle Software Downloads

The Java EE 5 Tutorial (PDF) - Oracle Software Downloads

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

For inline annotations, the declaration must be specified in the<br />

annotation element of the element. <strong>The</strong> must be<br />

specified in the annotation element of the enumeration member. This allows the enumeration<br />

member to be customized independently from the enumeration class.<br />

For information about typesafe enum design patterns, see the sample chapter of Joshua Bloch’s<br />

Effective <strong>Java</strong> Programming on the <strong>Java</strong> Developer Connection (http://java.sun.com/<br />

developer/Books/shiftintojava/page1.html).<br />

javadoc Binding Declarations<br />

<strong>The</strong> declaration lets you add custom <strong>Java</strong>doc tool annotations to schema-derived<br />

JAXB packages, classes, interfaces, methods, and fields. Note that declarations<br />

cannot be applied globally; they are only valid as sub-elements of other binding customizations.<br />

<strong>The</strong> syntax for the customization is:<br />

<br />

Contents in &lt;b><strong>Java</strong>doc&lt;\b> format.<br />

<br />

or<br />

<br />

format<br />

]]><br />

<br />

Note that documentation strings in declarations applied at the package level must<br />

contain open and close tags; for example:<br />

<br />

<br />

Package level documentation for generated package primer.myPo.]]><br />

<br />

<br />

Customization Namespace Prefix<br />

Customizing JAXB Bindings<br />

All standard JAXB binding declarations must be preceded by a namespace prefix that maps to<br />

the JAXB namespace URI (http://java.sun.com/xml/ns/jaxb). For example, in this sample,<br />

jxb: is used. To this end, any schema you want to customize with standard JAXB binding<br />

declarations must include the JAXB namespace declaration and JAXB version number at the<br />

top of the schema file. For example, in po.xsd for the Customize Inline example, the namespace<br />

declaration is as follows:<br />

Chapter 17 • Binding between XML Schema and <strong>Java</strong> Classes 523

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!