Package jakarta.xml.bind.annotation


package jakarta.xml.bind.annotation
Defines annotations for customizing Java program elements to XML Schema mapping.

References in this document to JAXB refer to the Jakarta XML Binding unless otherwise noted.

Package Specification

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

Annotations for customizing Java program elements to XML Schema mapping
Program Element Jakarta XML Binding annotation
Package
Class
Enum type
JavaBean Property/field
Parameter

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 Jakarta XML Binding 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:

  • For a property, a given annotation can be applied to either read or write property but not both.
  • A property name must be different from any other property name in any of the super classes of the class being mapped.
  • A mapped field name or the decapitalized name of a mapped property must be unique within a class.

Notations

Namespace prefixes

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

XML Schema fragments namespace prefixes
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
  • Class
    Description
    DomHandler<ElementT,ResultT extends Result>
    Converts an element (and its descendants) from/to DOM (or similar) representation.
    DomHandler implementation for W3C DOM (org.w3c.dom package.)
    Used by XmlAccessorOrder to control the ordering of properties and fields in a Jakarta XML Binding bound class.
    Controls the ordering of fields and properties in a class.
    Controls whether fields or Javabean properties are serialized by default.
    Used by XmlAccessorType to control serialization of fields or properties.
    Maps a JavaBean property to a map of wildcard attributes.
    Maps a JavaBean property to XML infoset representation and/or JAXBElement.
    Marks a field/property that its XML form is a URI reference to mime content.
    Maps a JavaBean property to an XML attribute.
    Maps a JavaBean property to an XML element derived from property name.
    Used in XmlElement.type() to signal that the type be inferred from the signature of the property.
    Maps a factory method to an XML element.
    Used in XmlElementDecl.scope() to signal that the declaration is in the global scope.
    Maps a JavaBean property to an XML element derived from property's type.
    Used in XmlElementRef.type() to signal that the type be inferred from the signature of the property.
    Marks a property that refers to classes with XmlElement or JAXBElement.
    A container for multiple @XmlElement annotations.
    Generates a wrapper element around XML representation.
    Maps an enum type Enum to XML representation.
    Maps an enum constant in Enum type to XML representation.
    Maps a JavaBean property to XML ID.
    Maps a JavaBean property to XML IDREF.
    Disable consideration of XOP encoding for datatypes that are bound to base64-encoded binary data in XML.
    Used to map a property to a list simple type.
    Associates the MIME type that controls the XML representation of the property.
    Annotate a JavaBean multi-valued property to support mixed content.
    Associates a namespace prefix with an XML namespace URI.
    Enumeration of XML Schema namespace qualifications.
    Marks a class that has XmlElementDecls.
    Maps a class or an enum type to an XML element.
    Maps a package name to an XML namespace.
    Maps a Java type to a simple schema built-in type.
    Used in XmlSchemaType.type() to signal that the type be inferred from the signature of the property.
    A container for multiple XmlSchemaType annotations.
    Instructs Jakarta XML Binding to also bind other classes when binding this class.
    Prevents the mapping of a JavaBean property/type to XML representation.
    Maps a class or an enum type to an XML Schema type.
    Used in XmlType.factoryClass() to signal that either factory mehod is not used or that it's in the class with this XmlType itself.
    Enables mapping a class to a XML Schema complex type with a simpleContent or an XML Schema simple type.