Menu

#228 make <class-a><class-b> optional

Dozer v5.3.2
open
nobody
5
2011-04-08
2011-04-08
legna
No

Due to some unfortunate circumstances out of my control I ended up having several copies of the same set of classes spread over different packages.

Subsequently they have the same properties but the only difference is just the package declaration (which is irrelevant for Dozer’s reflection based mapping mechanism).

So I need to map a set of "reflection" similar classes {A1, A2, A3, ...} to a set of "reflection" similar classes {B1, B2, B3, ...} .
As it is now for each A-B pair I have to define a mapping element :
<mapping><class-a>A1</class-a><class-b>B1</class-b><field><a>aaa</a><b>bbb</b></field> <!-- more fields --> </mapping>

I would like to be able to define just one mapping element which I can re-use for each A-B pair.

I would like to do something like
<mapping map-id="a-b"> <field><a>aaa</a><b>bbb</b></field> <!-- more fields --> </mapping>

And them on my java code just as usual:

mapper.map(com.a1.A, com.b1.B, "a-b");
mapper.map(com.a2.A, com.b1.B, "a-b");
mapper.map(com.a3.A, com.b1.B, "a-b");

Discussion


Log in to post a comment.