Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

#2624 Nested target methods should be inherited for forged Map to Bean methods#2626

Merged
filiphr merged 1 commit intomapstruct:mastermapstruct/mapstruct:masterfrom
filiphr:2624filiphr/mapstruct:2624Copy head branch name to clipboard
Oct 31, 2021
Merged

#2624 Nested target methods should be inherited for forged Map to Bean methods#2626
filiphr merged 1 commit intomapstruct:mastermapstruct/mapstruct:masterfrom
filiphr:2624filiphr/mapstruct:2624Copy head branch name to clipboard

Conversation

@filiphr
Copy link
Member

@filiphr filiphr commented Oct 24, 2021

Fixes #2624


Issue2624Mapper INSTANCE = Mappers.getMapper( Issue2624Mapper.class );

@Mapping( target = "department.id", source = "did")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice.. Just a thought.. you can't map nested sources, right? Since we don't know the type of the 'value' in the map if it's a Map<String, Object>..

I'm not sure how explicit the documentation is in this area (I remember that we discussed having a sourceType in @Mapping). And especially with reverting mappings (later on), this might to start to play a role. So also, perhaps we need to extend the documentation in this area.

I don't dare to ask 😄 .. but what happens if you specify a @Mapping(target = ".", source = "did")?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice.. Just a thought.. you can't map nested sources, right? Since we don't know the type of the 'value' in the map if it's a Map<String, Object>..

No we can't, that has already been reported in #2553

I don't dare to ask 😄 .. but what happens if you specify a @Mapping(target = ".", source = "did")?

You just did 😄 . I haven't tested this, but it will try to map whatever type the map value is to the current target. I don't really see a use case for this, so I'll rather wait for someone to complain about it 😄

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

by all means 👍

@filiphr filiphr merged commit 907d605 into mapstruct:master Oct 31, 2021
@filiphr filiphr deleted the 2624 branch October 31, 2021 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot map nested target when mapping from Map to Bean

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.