Issue on cyclic mapping with list
Romain-Alexandre opened this issue · 0 comments
Romain-Alexandre commented
Hi,
I'm trying to map a bean A which contains a list of beans B which itself contains a list of beans A.
I have @Mapper(withCyclicMapping = true)
annotation on each of interfaces.
Example :
public class Person {
private String firstName;
private String lastName;
private Date birthDay;
private List<Address> residencies;
// + Getters and Setters
}
public class Address {
private String line1;
private String line2;
private String zipCode;
private String city;
private String country;
private List<Person> persons // Cyclic reference here !
// + Getters and Setters
}
@Mapper(withCyclicMappings = true)
public interface PersonMapper {
// Returns a new instance of PersonDTO mapped from Person source
PersonDto asPersonDTO(Person source);
}
@Mapper(withCyclicMappings = true)
public interface AddressMapper {
// Returns a new instance of AddressDTO mapped from Address source
AddressDto asAddressDTO(Address source);
}
Implementations generated by SELMA from the interfaces do not compile because the mapping methods are duplicated.
Any idea about what's going wrong ?
Thanks