我似乎无法正确使用mapstruct
@Mapping(target = "products", source = "itemBookType")
SearchBookingResult backToTp(ItemBook itemBook);
Run Code Online (Sandbox Code Playgroud)
运行此代码时,我收到以下错误:
Can't map property "ProductType itemBookType" to "List<ProductOverview> products". Consider to declare/implement a mapping method: "List<ProductOverview> map(ProductType value)".
Run Code Online (Sandbox Code Playgroud)
我在底部添加了以下代码:
List<ProductOverview> map(ProductType value);
Run Code Online (Sandbox Code Playgroud)
但它仍然返回以下错误:
Can't generate mapping method from non-iterable type to iterable type from java stdlib.
Run Code Online (Sandbox Code Playgroud)
物品簿类别:
public class ItemBook {
private ProductType itemBookType; //ProductType class
private Integer idref;
private String reference;
}
Run Code Online (Sandbox Code Playgroud)
产品类型类别:
public enum ProductType {
BOOK, PHONE, GAME
}
Run Code Online (Sandbox Code Playgroud)
搜索预订结果类:
public class SearchBookingResult extends BaseResponse<SearchBookingResult> {
private …Run Code Online (Sandbox Code Playgroud)