A single-line patch to make MappingProcessor use multiple hints for destination classes during mapping of fields. It changes the behaviour of MappingProcessor only if both source and dest. hints are specified AND both are comma-separated lists (as described in the HintContainer).
This was needed when we wanted to map between a hierarchy of classes occurring as field types.
In short words:
Imagine a class A (will be mapped to APrime) with field "x" of type "X" (mapped to "x" of type "XPrime"). And now X type is abstract having several concrete subclasses (X1,X2,X3). The same hierarchy on the "right-hand-side" (XPrime having subclasses: X1Prime, X2Prime, X3Prime).
Let's say we want to map an instance of class A to APrime without knowing the very detail runtime type of x field value.
The solution is to have the mapping as follows:
<mapping>
<class-a>package.A</class-a>
<class-b>package.APrime</class-b>
<field>
<a>x</a>
<b>x</b>
<a-hint>package.X1,package.X2,package.X3</a-hint>
<b-hint>package.X1Prime,package.X2Prime,package.X3Prime</b-hint>
</field>
</mapping>
and run it like this:
mapper.map(new A(new X2(5L)), APrime.class);
Without this patch it doesn't work. Patching fixes the problem.
Patch against MappingProcessor
Used it and it works well.
I get more the feeling that itsn't a undocumented feature that wasn't unsed correctly.
Not quite sure if I understand you.
You think it was a undocumented feature (with a bug within), right?
(If so, I can nothing but agree)
Yep (wrote it wrong).
Fixes the following bug https://sourceforge.net/tracker2/?func=detail&aid=1865945&group_id=133517&atid=727368
I have submitted a test case to be sure (RuntimeSubclassMappingTest).
I wish all of Dozer problems would be fixed so easily :)
Thanks for the patch. Will be included in 4.3 release.
Dmitry
Go Dimitri ... go Dimitri .... :)