I have four classes:
public class A { }
public class B extends A { }
public class C extends B { }
public class D extends B { }
From what I read in the dozer documentation regarding inheritance, it must be pretty straight forward, I need to map super classes to each other, and as well for sub classes. Here is how it looks in the xml:
<mapping>
<class-a>foo.A</class-a>
<class-b>foo.bar.A</class-b>
</mapping>
<mapping>
<class-a>foo.B</class-a>
<class-b>foo.bar.B</class-b>
</mapping>
<mapping>
<class-a>foo.C</class-a>
<class-b>foo.bar.C</class-b>
</mapping>
<mapping>
<class-a>foo.D</class-a>
<class-b>foo.bar.D</class-b>
</mapping>
All these classes are identical, by that I mean D and D are having the same attributes, C and C and so on.
Problem: In the object I am passing to dozer, I have an attribute of type B, which could be initialized by C or D (polymorphism). When dozer gives back the new mapped object, it will always return the attribute type of B to me, and not C or D. How to fix this?