Java™ Platform
Standard Ed. 6

Package javax.xml.bind.annotation

Defines annotations for customizing Java program elements to XML Schema mapping.

See:
          Description

Interface Summary
DomHandler<ElementT,ResultT extends Result> Converts an element (and its descendants) from/to DOM (or similar) representation.
 

Class Summary
W3CDomHandler DomHandler implementation for W3C DOM (org.w3c.dom package.)
XmlElement.DEFAULT Used in XmlElement.type() to signal that the type be inferred from the signature of the property.
XmlElementDecl.GLOBAL Used in XmlElementDecl.scope() to signal that the declaration is in the global scope.
XmlElementRef.DEFAULT Used in XmlElementRef.type() to signal that the type be inferred from the signature of the property.
XmlSchemaType.DEFAULT Used in XmlSchemaType.type() to signal that the type be inferred from the signature of the property.
XmlType.DEFAULT Used in XmlType.factoryClass() to signal that either factory mehod is not used or that it's in the class with this XmlType itself.
 

Enum Summary
XmlAccessOrder Used by XmlAccessorOrder to control the ordering of properties and fields in a JAXB bound class.
XmlAccessType Used by XmlAccessorType to control serialization of fields or properties.
XmlNsForm Enumeration of XML Schema namespace qualifications.
 

Annotation Types Summary
XmlAccessorOrder Controls the ordering of fields and properties in a class.
XmlAccessorType Controls whether fields or Javabean properties are serialized by default.
XmlAnyAttribute Maps a JavaBean property to a map of wildcard attributes.
XmlAnyElement Maps a JavaBean property to XML infoset representation and/or JAXB element.
XmlAttachmentRef Marks a field/property that its XML form is a uri reference to mime content.
XmlAttribute Maps a JavaBean property to a XML attribute.
XmlElement Maps a JavaBean property to a XML element derived from property name.
XmlElementDecl Maps a factory method to a XML element.
XmlElementRef Maps a JavaBean property to a XML element derived from property's type.
XmlElementRefs Marks a property that refers to classes with XmlElement or JAXBElement.
XmlElements A container for multiple @XmlElement annotations.
XmlElementWrapper Generates a wrapper element around XML representation.
XmlEnum Maps an enum type Enum to XML representation.
XmlEnumValue Maps an enum constant in Enum type to XML representation.
XmlID Maps a JavaBean property to XML ID.
XmlIDREF Maps a JavaBean property to XML IDREF.
XmlInlineBinaryData Disable consideration of XOP encoding for datatypes that are bound to base64-encoded binary data in XML.
XmlList Used to map a property to a list simple type.
XmlMimeType Associates the MIME type that controls the XML representation of the property.
XmlMixed Annotate a JavaBean multi-valued property to support mixed content.
XmlNs Associates a namespace prefix with a XML namespace URI.
XmlRegistry Marks a class that has XmlElementDecls.
XmlRootElement Maps a class or an enum type to an XML element.
XmlSchema Maps a package name to a XML namespace.
XmlSchemaType Maps a Java type to a simple schema built-in type.
XmlSchemaTypes A container for multiple @XmlSchemaType annotations.
XmlSeeAlso Instructs JAXB to also bind other classes when binding this class.
XmlTransient Prevents the mapping of a JavaBean property/type to XML representation.
XmlType Maps a class or an enum type to a XML Schema type.
XmlValue Enables mapping a class to a XML Schema complex type with a simpleContent or a XML Schema simple type.
 

Package javax.xml.bind.annotation Description

Defines annotations for customizing Java program elements to XML Schema mapping.

Package Specification

The following table shows the JAXB mapping annotations that can be associated with each program element.

Program Element JAXB annotation
Package
XmlAccessorOrder
XmlAccessorType
XmlSchema
XmlSchemaType
XmlSchemaTypes
XmlJavaTypeAdapter
XmlJavaTypeAdapters
Class
XmlAccessorOrder
XmlAccessorType
XmlInlineBinaryData
XmlRootElement
XmlType
XmlJavaTypeAdapter
Enum type
XmlEnum
XmlEnumValue (enum constant only)
XmlRootElement
XmlType
XmlJavaTypeAdapter
JavaBean Property/field
XmlElement
XmlElements
XmlElementRef
XmlElementRefs
XmlElementWrapper
XmlAnyElement
XmlAttribute
XmlAnyAttribute
XmlTransient
XmlValue
XmlID
XmlIDREF
XmlList
XmlMixed
XmlMimeType
XmlAttachmentRef
XmlInlineBinaryData
XmlElementDecl (only on method)
XmlJavaTypeAdapter
Parameter
XmlList
XmlAttachmentRef
XmlMimeType
XmlJavaTypeAdapter

Terminology

JavaBean property and field: For the purposes of mapping, there is no semantic difference between a field and a JavaBean property. Thus, an annotation that can be applied to a JavaBean property can always be applied to a field. Hence in the Javadoc documentation, for brevity, the term JavaBean property or property is used to mean either JavaBean property or a field. Where required, both are explicitly mentioned.

top level class: For the purpose of mapping, there is no semantic difference between a top level class and a static nested class. Thus, an annotation that can be applied to a top level class, can always be applied to a nested static class. Hence in the Javadoc documentation, for brevity, the term "top level class" or just class is used to mean either a top level class or a nested static class.

mapping annotation:A JAXB 2.0 defined program annotation based on the JSR 175 programming annotation facility.

Common Usage Constraints

The following usage constraints are defined here since they apply to more than annotation:

Notations

Namespace prefixes

The following namespace prefixes are used in the XML Schema fragments in this package.

Prefix Namespace Notes
xs http://www.w3.org/2001/XMLSchema Namespace of XML Schema namespace
ref http://ws-i.org/profiles/basic/1.1/xsd Namespace for swaref schema component
xsi http://www.w3.org/2001/XMLSchema-instance XML Schema namespace for instances

Since:
JAXB 2.0

Java™ Platform
Standard Ed. 6

Submit a bug or feature
For further API reference and developer documentation, see Java SE Developer Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.

Copyright 2008 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.