#MapStruct mapping error

1 messages · Page 1 of 1 (latest)

obtuse dawn
#

Using mapstruct results with following error, why?

Ambiguous mapping methods found for mapping collection element to java.lang.Object: com.xx.ProductAsset parseFromEntity(com.xx.ProductAssetEntity productAsset), com.xx.ProductAssetSnapshot productAssetEntityToProductAssetSnapshot(com.xx.ProductAssetEntity productAsset).
@Mapper(
    componentModel = "spring",
    nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE)
public interface ProductAssetMapper {

  @Mapping(
      target = "tags",
      expression = "java(com.wiz.lib.utils.MapperUtils.stringToArray(productAsset.getTags()))")
  ProductAsset parseFromEntity(ProductAssetEntity productAsset);

  @Mapping(target = "variantCount", expression = "java(productAsset.getVariants().size())")
  ProductAssetSnapshot productAssetEntityToProductAssetSnapshot(ProductAssetEntity productAsset);

  Iterable<ProductAssetSnapshot> parseSnapshot(Iterable<ProductAssetEntity> iterables);
}

Why mapstruct doesn't detect that Iterable<ProductAssetEntity> source model in parseSnapshot should convert to ProductAssetSnapshot? That is, to use productAssetEntityToProductAssetSnapshot for each item in Iterable?

strange merlinBOT
#

<@&1004656351647117403> please have a look, thanks.