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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Customizing Generated Classes and <strong>Java</strong> Program Elements<br />

494<br />

<strong>Java</strong>-to-Schema<br />

<strong>The</strong> JAXB annotations defined in the javax.xml.bind.annotations package can be used to<br />

customize <strong>Java</strong> program elements to XML schema mapping. Table 17–3 summarizes the JAXB<br />

annotations that can be used with a <strong>Java</strong> package.<br />

TABLE 17–3 JAXB Annotations Associated with a <strong>Java</strong> Package<br />

Annotation Description and Default Setting<br />

@XmlSchema Maps a package to an XML target namespace. Default Settings:<br />

@XmlSchema (<br />

xmlns = {},<br />

namespace = "",<br />

elementFormDefault = XmlNsForm.UNSET,<br />

attributeFormDefault = XmlNsForm.UNSET<br />

)<br />

@XmlAccessorType Controls default serialization of fields and properties. Default Settings:<br />

@XmlAccessorType (<br />

value = AccessType.PUBLIC_MEMBER<br />

)<br />

@XmlAccessorOrder Controls the default ordering of properties and fields mapped to XML elements.<br />

Default Settings:<br />

@XmlAccessorOrder (<br />

value = AccessorOrder.UNDEFINED<br />

)<br />

@XmlSchemaType Allows a customized mapping to an XML Schema built-in type. Default Settings:<br />

@XmlSchemaType (<br />

namespace = "http://www.w3.org/2001/XMLSchema",<br />

type = DEFAULT.class<br />

)<br />

@XmlSchemaTypes A container annotation for defining multiple @XmlSchemaType annotations. Default<br />

Settings:<br />

None<br />

Table 17–4 summarizes JAXB annotations that can be used with a <strong>Java</strong> class.<br />

<strong>The</strong> <strong>Java</strong> <strong>EE</strong> 5<strong>Tutorial</strong> • June 2010

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

Saved successfully!

Ooh no, something went wrong!