I try my best to get a Dozer to bend my will for something that, in my opinion, should be fairly simple. I have two similar models that I want to compare with each other, but I have a deeper hierarchy than the other, and this causes me problems when working with collections. Consider the following classes:
Source classes:
class Foo {
String id;
NameGroup nameGroup;
}
class NameGroup {
private List<Name> names;
}
class Name {
private String nameValue;
}
Target classes:
class Bar {
private String barId;
private BarNames barNames;
}
class BarNames {
private List<String> names;
}
Now I need the following one-way mappings:
Foo.id -> Bar.barId
But then I need:
Foo.nameGroup.names.nameValue -> Bar.barNames.names
Therefore, each instance Namein Foo.nameGroup.namesshould result in being added Stringto the list BarNames.names. Is it possible?
source
share