background image

Java-to-Schema

<< Customizing Generated Classes | JAXB Annotations >>
<< Customizing Generated Classes | JAXB Annotations >>

Java-to-Schema

Java-to-Schema
The JAXB annotations defined in the javax.xml.bind.annotations package can be used to
customize Java program elements to XML schema mapping.
Table 17­3
summarizes the JAXB
annotations that can be used with a Java package.
TABLE 17­3
JAXB Annotations Associated with a Java Package
Annotation
Description and Default Setting
@XmlSchema
Maps a package to an XML target namespace. Default Settings:
@XmlSchema (
xmlns = {},
namespace =
"",
elementFormDefault = XmlNsForm.UNSET,
attributeFormDefault = XmlNsForm.UNSET
)
@XmlAccessorType
Controls default serialization of fields and properties. Default Settings:
@XmlAccessorType (
value = AccessType.PUBLIC_MEMBER
)
@XmlAccessorOrder
Controls the default ordering of properties and fields mapped to XML elements.
Default Settings:
@XmlAccessorOrder (
value = AccessorOrder.UNDEFINED
)
@XmlSchemaType
Allows a customized mapping to an XML Schema built-in type. Default Settings:
@XmlSchemaType (
namespace =
"http://www.w3.org/2001/XMLSchema",
type = DEFAULT.class
)
@XmlSchemaTypes
A container annotation for defining multiple @XmlSchemaType annotations. Default
Settings:
None
Table 17­4
summarizes JAXB annotations that can be used with a Java class.
Customizing Generated Classes and Java Program Elements
The Java EE 5 Tutorial · September 2007
496