You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In a project I'm working on, it would be really useful if MapStruct supported collection mapping methods with multiple source parameters.
Such methods would only be supported when all of the following conditions are met. Otherwise, MapStruct should raise an error, in the same way it does when no suitable mapping method can be found.
The target type is an iterable or array type.
The first source parameter is an iterable or array type.
Any subsequent source parameters are non-iterable/non-array types.
A per-element mapping method exists with the same parameter list, except that the iterable/array source parameter is replaced by its element type and the iterable/array target type is replaced by its element type.
This seems like a natural extension of MapStruct's existing collection mapping support, with additional source parameters simply forwarded unchanged to the element-mapping method.
Would this be something the project would be interested in supporting? If so, I'd be happy to work on an implementation and submit a pull request.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
In a project I'm working on, it would be really useful if MapStruct supported collection mapping methods with multiple source parameters.
Such methods would only be supported when all of the following conditions are met. Otherwise, MapStruct should raise an error, in the same way it does when no suitable mapping method can be found.
Such a mapper could look like this:
and the generated code could look something like:
This seems like a natural extension of MapStruct's existing collection mapping support, with additional source parameters simply forwarded unchanged to the element-mapping method.
Would this be something the project would be interested in supporting? If so, I'd be happy to work on an implementation and submit a pull request.
Beta Was this translation helpful? Give feedback.
All reactions