I'm trying to use mapstruct to map one list to another .While mapping i want to add some info in one particular field but unable to do it . I will be glad if someone could able to provide some solution.
ex- If i've List of People( {"1", "John"}, {"2", "Tom"} )
modify it to -> Employee({"1","Employee with name: John"}, {"2","Employee with name: Tom"} )
public class Employee {
String id;
String info;
}
public class People {
String id;
String name;
}
@Mapping(source = "people.name", target = "displayName", qualifiedByName = "displayName")
List<Employee> toEmployee(List<People> people);
@Named("displayName")
default String getAudioId(String name){
return "Employee with name:" + name;
}