I'm struggling to get Dozer to bend to my will for something that I feel should be quite simple. I have two similar models that I wish to map between, however one has a 'deeper' hierarchy than the other and this is causing me problems when dealing with collections. Consider the following classes:
Source classes:
class Foo {
String id;
NameGroup nameGroup;
// Setters/Getters
}
class NameGroup {
private List<Name> names;
// Setters/Getters
}
class Name {
private String nameValue;
// Setters/Getters
}
Destination classes:
class Bar {
private String barId;
private BarNames barNames;
// Setters/Getters
}
class BarNames {
private List<String> names;
// Setters/Getters
}
Now I'd like the following one-way mappings:
Foo.id -> Bar.barId // Simple enough
But I then need:
Foo.nameGroup.names.nameValue -> Bar.barNames.names
So each Name
instance in Foo.nameGroup.names
should result in a String
being added to the BarNames.names
list. Is this possible?