GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

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

New issue
Copy link
New issue
Copy link
Closed
#2993
Closed
Ambiguous mapping method but there is a more specific mapping#1216
#2993
Copy link
Labels
enhancement
Milestone
1.6.0.Beta1

Description

@filiphr
filiphr
opened on May 30, 2017
Issue body actions

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

  1. andresmontoyat commented on Jul 1, 2017

    @andresmontoyat
    andresmontoyat
    on Jul 1, 2017
    More actions

    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
    
  2. filiphr commented on Jul 5, 2017

    @filiphr
    filiphr
    on Jul 5, 2017
    MemberAuthor
    More actions

    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.

  3. filiphr
    added this to the 1.6.0 milestone on Jul 8, 2022
  4. filiphr
    added a commit that references this issue on Aug 28, 2022

    mapstruct#1216 Pick candidate method with most specific return type

    5146fd7
  5. filiphr
    added
    enhancement
    on Oct 2, 2022
  6. filiphr
    closed this as completedin #2993on Oct 2, 2022
  7. filiphr
    added a commit that references this issue on Oct 2, 2022

    #1216 Pick candidate method with most specific return type

    266c5fa
  8. filiphr
    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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      • 1.6.0.Beta1

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.