'''OPEN ISSUE:''' Should we include additional support for non-String, and composite keys? If so, should we include additional bind()/resolve() methods, or force the user to change to a new method signature?

Revision as of 13:13, 20 October 2011

Contents

Design Documentation: IDResolver

In the current JAXB RI, developed by Sun, there are a series of "proprietary" JAXB extensions that are available to provide advanced JAXB functionality outside of the JAXB spec (these extension classes reside in the com.sun.xml.bind package).

The abstract class IDResolver provided in the Sun JAXB implementation allows users to override the ID/IDREF processing of the JAXB runtime.

This document will outline the design for an EclipseLink equivalent to this extension.

Requirements

Deliver an abstract IDResolver class in the EclipseLink library that will provide the same functionality as the Sun extension.

Given a String id and Object obj, allow the user to perform custom bind code

Given a String id and Class type, allow the user to perform custom resolve code

Provide the user a hook into startDocument() and endDocument() events

Unlike Sun's JAXB implementation, EclipseLink MOXy is not restricted to String-only IDs. Therefore, we will add additional methods to support complex IDs.

Given a IDWrapper id and Object obj, allow the user to perform custom bind code

Given a IDWrapper id and Class type, allow the user to perform custom resolve

Behaviour

If an IDResolver has been set on the Unmarshaller (via properties), then the following things must happen during unmarshal:

The IDResolver's startDocument() method must be called when unmarshalling starts.

When an ID value is encountered during unmarshal, the IDResolver's bind method must be called, to bind the object to the ID.

When an IDREF value is encountered during unmarshal, the IDResolver's resolve method must be used to obtain the object for the IDREF.

The IDResolver's endDocument() method must be called when unmarshalling completes.