Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue on cyclic mapping with list #206

Open
Romain-Alexandre opened this issue Sep 9, 2019 · 0 comments
Open

Issue on cyclic mapping with list #206

Romain-Alexandre opened this issue Sep 9, 2019 · 0 comments

Comments

@Romain-Alexandre
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant