-
-
Notifications
You must be signed in to change notification settings - Fork 979
Using target="." Doesn't seem to handle collections #2444
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
It is indeed obvious what you are trying to achieve. However, the implementation for something like this is not entirely straightforward. MapStruct does not have support for this because and it is not as easy as you might think. How can MapStruct know what should be considered as a key and value for the I would suggest following #1075 which will add support for mapping from For the time being you have to do that mapping by hand. |
@filiphr , I was not expecting MapStruct to find keys and values automatically. That code would have to be implemented by the user on a method with the list as source and the target class as target (parameters), just as I stated on the example above. I believe this wouldn't be hard at all, right? |
So you are looking for the code to invoke I would actually suggest something else here. You can do the exact same thing in e.g.
|
I guess that works. Thanks for the help |
My use case is the following:
target has some attributes (attr1, attr2, attr3).
source has a list of objects with key and value like:
I guess the mapping I'm targeting is pretty obvious by now, So what I did was:
but this doesn't generate any mapping code. I took a peek on the source code and it seems to handle only single objects.
The text was updated successfully, but these errors were encountered: