'how to map list inside class to single object with mapsturct
I want to convert my list inside class to single object.
From :
Class School
private List<SchoolAccount> schoolAccounts;
Class SchoolAccount
private Integer schoolId;
to :
Class SchoolDto
private Integer schoolId;
My mapper class
@Mapper
public interface SchoolMapper {
SchoolMapper INSTANCE= Mappers.getMapper(SchoolMapper.class);
@Mapping(source = "schoolId", target = "SchoolAccount.schoolId")
void mergeschoolIdDto(SchoolDto, @MappingTarget School School);
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
