I created a dozer mapping for ClassA to ClassB.
Now I want to map a List<ClassA>
to a List<ClassB>
.
Is it possible to just
mapper.map(variableListClassA, variableListClassB)
or do I have to go over a loop, e.g.
for (ClassA classA : variableListClassA) {
variableListClassB.add(mapper.map(classA, ClassB.class))
}
You need to use the loop, because the type of the list is erased at runtime.
If both lists are a field of a class, you can map the owning classes.