【发布时间】:2021-02-06 10:09:11
【问题描述】:
我知道有一个类似的问题(请参阅question),但我没有找到有用的答案。假设我有以下课程:
class QuestionType {
private String type;
}
class Profile {
private String name;
private int id;
}
class ProfileResponse {
private String name;
private int id;
private String type;
}
如何使用 MapStruct (1.3.1) 将 HashMap<QuestionType, Profile> 转换为 List<ProfileResponse>
@Mapper(componentModel = "spring")
public interface ProfileResponseMapper {
List<ProfileResponse> toProfileResponse(Map<QuestionType, Profile> profiles);
}
【问题讨论】:
标签: java list dictionary mapping mapstruct