Currently, Dozer does not support conversion from JAXBElement<Type> to java.*.type. It does not seem to recognize that these are different classes, and actually assigns the JAXBElement-wrapped value to the plain old java type object at runtime. This causes problems at runtime (generally, the converter also appears to be having trouble with parametrized types).
It would be great if parametrized (as they all have to be) JAXBElement objects could be automatically converted to their unwrapped value types. In other words, when given:
CLASS SOURCE:
JAXBElement<String> testString = new JAXBElement(new QName(), "JAXB Element String Value", String.class);
CLASS DESTINATION:
String testString = "";
In this case, calling mapper.map(source, Destination.class) should automatically call getValue() on the Source class's JAXBElement attribute, and set the Destination.testString value to that string.
Right now I see a solution as simple as custom converter enabled globally in configuration block. We could provide that in the Dozer distribution for developers to enable.
View and moderate all "feature-requests Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Feature Requests"
When are you planning to add this feature (or offer theses custom converters)?
Currently Dozer is nearly unusable for devs who are forced to work with jaxb...
Last edit: Anonymous 2015-01-08
Still no movement here?
I just create a new pull-request thats resolve this issue, look at:
https://github.com/DozerMapper/dozer/pull/101
or review this in my personal fork, at:
https://github.com/pepebarragan/dozer