GeezerVison is showing github.com — Ambiguous mapping method but there is a more specific mapping · Issue #1216 · mapstruct/mapstruct
Ambiguous mapping method but there is a more specific mapping #1216
Description
I have a util class that has the following methods:
public static java.util.Date toUtilDate(String strDate);
public static java.sql.TimeStamp toTimeStamp(String strDate);
public static java.sql.TimeStamp toTimeStamp2(String strDate);
public static java.sql.Date toSqlDate(String strDate);
I want to map from String to java.util.Date. I am getting an Ambiguous mapping error. I think that if an explicit mapping between String to java.util.Date exists then we should select that method. If the toUtilDate method didn't exists then we should throw the error.
WDYT?
Activity
andresmontoyat commented on Jul 1, 2017
H!,
I have the following problem, this is my example:
this is a model object:
public class CurriculumViewModel extends CurriculumModel
...
this is my mapper methods:
public CurriculumModel toCurriculumModel(Curriculum domain);
@Mappings({
@Mapping(source = "id", target = "id"),
@Mapping(source = "headLine", target = "headLine"),
@Mapping(source = "summary", target = "summary"),
@Mapping(source = "location", target = "location")
})
public CurriculumViewModel toCurriculumViewModel(Curriculum domain);
this is my error message:
Ambiguous mapping methods found for mapping collection element to
filiphr commented on Jul 5, 2017
As discussed in the gitter chat. We need some more information for the error in order to help you out. You might need to specify on which method exactly does the error occur and in which mapper.
added a commit that references this issue
on Oct 2, 2022#1216 Pick candidate method with most specific return type
changed the title
[-]Ambiguous mapping method but there is a most specific mapping[/-] [+]Ambiguous mapping method but there is a more specific mapping[/+] on Oct 10, 2023
Metadata
Metadata
Development
No branches or pull requestsIssue actions