'mapping Embedded List from single element with mapstruct
I worked with mappstruct, and I have an issue, I don't know if mapstruct can help with it The probleme is I have a DATA class
public class Data {
private String firstName;
private String lastName;
private String state;
private String city;
private String street;
private String zipCode;
}
and Address
Entity
public class Address {
@Id
private Long id;
private String state;
private String city;
private String street;
private String zipCode;
and Person
@Data
public class Person {
@Id
private Long id;
private String firstName;
private String lastName;
private String email;
private List<Address> list;
}```
So the person have a list of address and I want from One Data object create one adresse Object
and add that object to Person
So after the mapping I need to have Person with List(size == 1) of address
the mapper
@Mapper public interface DataToPerson {
DataToPerson MAPPER = Mappers.getMapper(DataToPerson.class);
Person dataToPerson(Data data);
}
is that possible ?
Thank you so much
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
