Jump to: navigation, search

EclipseLink/DesignDocs/293925/PathBasedMappings

Path-based Mapping Support

Provide support for path-based mappings.

Design Decisions

Decision Point 1: xml-attribute/xml-element vs. xml-element-wrapper

There are three possible options for supporting path-based mappings:

  • Utilize the xml-attribute and xml-element structures
    • Issue: if this apporach is taken, what is the expected behavior when an xml-element-wrapper is used with an xml-element that has the path set?
  • Utilize the xml-element-wrapper structure
    • For this approach to work, we will have to enable use with single-valued properties and xml-attribute

The preferred approach is to utilize the xml-attribute and xml-element structures.

Decision Point 2: name overload vs. xml-path vs. name + grouping-element

We will need to consider three possible methods of specifying the path for a given mapping:

  • Overload the name attribute
    • This is the most simple approach, as no new attributes/elements need to be introduced.
    • name can be used to set the path as follows:
      • name="projects/project/id"
    • Issue: this approach would require use of a standard mechanism in a non-standard way - is this acceptable?
  • Add a new xml-path attribute
    • With this approach, the xml-path would contain the entire path, i.e.:
      • xml-path="projects/project/id"
    • Issue: if both name and xml-path are set, which takes precedence?
  • Combine name with a new grouping-element attribute
    • With this approach a grouping element would be combined with the name to get the entire path, i.e.:
      • name="id" grouping-element="projects/project"

The preferred approach would be to Add a new xml-path attribute

Decision Point 3: Optional Element Usage

If use of xml-element-wrapper is chosen in Decision Point 1 above, what will the expected behavior be when namespace, nillable, and/or required is set in addition to an XPath?

Regarding namespace, the preferred approach is to apply the namespace to any path element that isn't already prefixed. Regarding nillable, and/or required, the preferred approach is to apply these to the last path element.