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
It would be nice to be able to map the index of the current element in the source list to a property in the target collection. I imagine sth like @Mapping(source = "#currentIndex" target = "recordIndexField")
(bonus points, I suppose, for being able to reference it in other contexts as well, e.g. expression = "java(someCustomMethod(#currentIndex))")
Generated Code
No response
Possible workarounds
The only workaround I could think of was to iterate over the collection programmatically, which meant it was also clearer to use a per-element mapper, instead of a collection mapper
MapStruct Version
No response
The text was updated successfully, but these errors were encountered:
Use case
It would be nice to be able to map the index of the current element in the source list to a property in the target collection. I imagine sth like
@Mapping(source = "#currentIndex" target = "recordIndexField")
(bonus points, I suppose, for being able to reference it in other contexts as well, e.g.
expression = "java(someCustomMethod(#currentIndex))"
)Generated Code
No response
Possible workarounds
The only workaround I could think of was to iterate over the collection programmatically, which meant it was also clearer to use a per-element mapper, instead of a collection mapper
MapStruct Version
No response
The text was updated successfully, but these errors were encountered: