Skip to content

Ambiguous mapping methods found for mapping collection element to java.lang.Object #2722

@adminSxs

Description

@adminSxs
Java Version:  1.8
mapstruct: 1.3.0.Final
SpringBoot: 2.2.0

example:

@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);
}

execute:

mvn compile

Error:

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions