I want to have a 2 way mapping from a List of an object to an Object which contains a List.
class Person {
String firstName;
String lastName;
}
class Group { // Source
List<Person> people;
String groupID;
...
}
class Employee { // target
String firstName;
String lastName;
String employeeNumber;
...
}
I used ReportingPolicy.IGNORED to ignore all the irrelevant fields. I just want a mapping between Group to List with the fields firstName and lastName.
Is it possible at all? I have tried but it's giving me error during build "impossible to map iterable to non-iterable."
@Mapping(target="people", source".")
Group map(List<Employee>)