MOXy support for inheritance (Java -> XML) [message #658209] |
Mon, 07 March 2011 07:26  |
Eclipse User |
|
|
|
Hello,
I'm currently evaluating MOXy in the case of unmarshalling an input XML fragment file into a Java class (or set of classes).
The Java class itself inherits from generic business classes, and most of the properties/attributes belong to the superclasses. Since i cannot modify those business classes, I use the external metadata facility provided by MOXy to configure the XML->Java mappings.
Here's a sample of that metadata config file:
<?xml version="1.0" encoding="UTF-8"?>
<xml-bindings
xmlns="http://www.eclipse.org/eclipselink/xsds/persistence/oxm"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.eclipse.org/eclipselink/xsds/persistence/oxm eclipselink/xsds/eclipselink_oxm_2_2.xsd"
package-name="xyz.integration.stocks.domain">
<java-types>
<java-type name="xyz.integration.stocks.domain.Stock"
xml-accessor-type="PUBLIC_MEMBER" >
<xml-root-element name="stock" />
<xml-type name="stock" />
<java-attributes>
<xml-element java-attribute="ref"
xml-path="ref/text()" />
</java-attributes>
</java-type>
</java-types>
</xml-bindings>
Starting a JUnit test case, I get the following warning message :
Ignoring attribute [ref] on class [xyz.integration.stocks.domain.IntegrationStock] as no Property was generated for it
As expected from the message above, the mapping is skipped and my result class property 'ref' is null...
How can I tell MOXy to support such an inheritance ?
Thank you in advance.
Regards
/Xavier
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04366 seconds