With predetermined class structure like this:
@XmlRootElement
class Root {
Foo property;
transient Wrapper wrapper;
}
class Wrapper {
Foo wrappedProperty;
}
I would like to be able to marshal it to
<root>
<property>Foo, mapped to a certain complexType</property>
</root>
ignoring the wrapper, but unfortunately unmarshal the property data to inside of the wrapper (only).
Is it possible to do something like this with JAXB, probably using some MOXy extensions? Or is manual postprocessing of the unmarshaled object my best option?
- An
XmlAdapterforRootwill not work automatically, sinceRootis, well, a root element. - Two Java properties mapped, one read-only and one write-only, to the same XML element don’t seem to make MOXy happy.
- I have no experience with MOXy
@XmlTransformation, would it be able to help here?
Note: I’m the EclipseLink JAXB (MOXy) lead.
I apologize for the delay in responding. The use case you describe is not currently supported. I have entered the following enhancement request that you can use to track our progress on this issue: