Skip to content

#3708 Support CollectionMappingStrategy on @BeanMapping and @Mapping#3935

Open
znight1020 wants to merge 2 commits intomapstruct:mainfrom
znight1020:feature/3708-support-collection-mapping-strategy
Open

#3708 Support CollectionMappingStrategy on @BeanMapping and @Mapping#3935
znight1020 wants to merge 2 commits intomapstruct:mainfrom
znight1020:feature/3708-support-collection-mapping-strategy

Conversation

@znight1020
Copy link
Copy Markdown
Contributor

Overview

This PR Support for CollectionMappingStrategy on the @BeanMapping and @Mapping. This allows for more granular control over the collection mapping strategy at the individual method or property level, rather than relying solely on the global configuration set for the entire mapper.

Key Changes

  • @BeanMapping Support:
    • A collectionMappingStrategy has been added to the @BeanMapping annotation interface.
    • The annotation processor now reads this strategy and applies it as the default for all property mappings within the method, unless overridden by a more specific @Mapping annotation.
  • @Mapping Support:
    • A collectionMappingStrategy member has been added to the @Mapping annotation interface.
    • The code generation logic has been updated to prioritize the strategy set on a specific @Mapping.

With these changes, we can now flexibly control the strategy for populating target collections for specific use cases, without altering the global mapper configuration.

The resolution priority is as follows: @Mapping > @BeanMapping > @Mapper > @MapperConfig.

Signed-off-by: Hyeonsoo Lee <znight1020@naver.com>
Signed-off-by: Hyeonsoo Lee <znight1020@naver.com>
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.

1 participant