Developing JAXB Applications Using EclipseLink MOXy,
Release 2.6
Contents
List of Examples
List of Figures
Title and Copyright Information
Preface
Audience
Conventions
1
Introduction
About EclipseLink MOXy
Solving Object-XML Impedance Mismatch
About This Documentation
Other Resources
2
EclipseLink MOXy Runtime
Specifying the EclipseLink Runtime
Bootstrapping
Using the JAXBContext API
Bootstrapping from Classes
Bootstrapping from a Context Path
Using a
jaxb.index
File
Using an ObjectFactory
Using MetadataSource
Bootstrapping from EclipseLink XML Bindings
Combining Annotated Classes and XML Bindings
Using XML Bindings
Understanding the XML Bindings Format
Bootstrapping with XML Bindings
Using XML Bindings with Annotations
Using Multiple Bindings Documents
Understanding Override Rules
Using Complete Metadata
Using Virtual Mappings
Using MetadataSource
Implementing a MetadataSource
Using an XmlBindings Object
Specifying the MetadataSource
MetadataSource Example
Building XmlBindings Programatically
Generating an XML Schema
Validating Against an XML Schema
Using a ValidationEventHandler
Enabling Validation
Input (input.xml File)
Output
Understanding Events
Adding Event Listener Methods on JAXB Mapped Objects
Registering Listeners on Marshallers and Unmarshallers
Querying Objects by XPath
Binding to an Existing Document
3
Mapping Type Levels
Defining the Default Root Element
Customizing the Default Root Element
Understanding How EclipseLink Uses the Default Root Element
Setting Up Namespace Information
Qualifying at the Package Level
Qualifying at the Type Level
Qualifying at the Field/Property Level
Specifying Inheritance
Using xsi:type
Using Substitution Groups
Using @XmlDiscriminatorNode/@XmlDiscriminatorValue
4
Mapping Simple Values
Mapping Simple Values
Mapping to an Attribute
Mapping to a Text Node
Mapping to a Text Node in a Simple Sequence
Mapping to a Text Node in a Sub-element
Mapping to a Text Node by Position
Mapping to a Simple Text Node
Mapping to a Specified Schema Type
Using Java Type Adapters
Mapping with a Simple Type Translator
Mapping Collections of Simple Values
Mapping to Text Nodes
Mapping to Text Nodes with a Grouping Element
Mapping to a List Element
Mapping a Collection of XmlAttributes or XmlValues
Multiple Mappings for a Single Property
Example
XML Output
Mapping Enums
Mapping Enums using Constant Names
Mapping Enums to Custom XML Values
5
Mapping Special Schema Types
Mapping Dates and Times
Understanding the Generated Model
Using a Different Date (or Calendar) Property
Mapping to a Union Field
Understanding Conversion Order
Customizing Conversion Classes
Binary Types
Specifying Binary Formats Base64 and Hex
Understanding byte[] versus Byte[]
Working with SOAP Attachments
Using @XmlInlineBinaryData
Using @XmlMimeType
6
Privately Owned Relationships
Mapping Privately Owned One-to-One Relationships
Mapping to an Element
Using EclipseLink's @XmlPath Annotation
Mapping Privately Owned One-to-Many Relationships
Mapping to Elements
Grouping Elements using the @XmlElementWrapper Annotation
7
Mapping Shared Reference Relationships
Understanding Keys and Foreign Keys
Mapping Single Key Relationships
Using @XmlList
Using the Embedded Key Class
Mapping Composite Key Relationships
Mapping Bidirectional Relationships
See also
8
Advanced Concepts
Refreshing Metadata
Customizing XML Name Conversions
Using the XMLNameTransformer
Example Model
Specifying the Naming Algorithm
XML Output
Using Virtual Access Methods
Configuring Virtual Access Methods
Example
Using XmlAccessType.FIELD and XmlTransient
Options
Specifying Alternate Accessor Methods
Specifying Schema Generation Options
Using Extensible MOXy
Using the @XmlVirtualAccessMethods Annotation
Creating Tenant 1
Creating Tenant 2
Mapping Using XPath Predicates
Mapping with XPath Predicates
Mapping Based on Position
Mapping Based on an Attribute Value
Creating "Self" Mappings
Using an XmlAdapter
Using java.util.Currency
Using java.awt.Point
Specifying Package-Level Adapters
Specifying Class-Level @XmlJavaTypeAdapters
Using XML Transformations
Using an AttributeTransformer
Using a FieldTransformer
Generating Java Classes from an XML Schema
Running the JAXB Compiler
Customizing Generated Mappings
9
Using Dynamic JAXB
Understanding Static and Dynamic Entities
Using Static MOXy
Using Dynamic MOXy
Using Dynamic Entities
Specifying the EclipseLink Runtime
Instantiating a DynamicJAXBContext
Bootstrapping from XML Schema (XSD)
Importing Other Schemas / EntityResolvers
Customizing Generated Mappings with XJC External Binding Customization Files
Bootstrapping from EclipseLink Metadata (OXM)
Example
10
Using JSON Documents
Understanding JSON Documents
Marshalling and Unmarshalling JSON Documents
Specifying JSON Bindings
Specifying JSON Data Types
Supporting Attributes
Supporting no Root Element
Using Namespaces
Using Collections
Mapping Root-Level Collections
Wrapping XML Values
Copyright © 2013 by The Eclipse Foundation under the
Eclipse Public License (EPL)