-
-
Notifications
You must be signed in to change notification settings - Fork 979
[Feature] Mapping hashmap from a field #1218
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
Thanks for the feature request @DavidWylie. I think that this one is similar to #1075 and #717. I think we had one other feature request that was requesting to provide the index of a list. I think that it is an interesting feature for MapStruct. If you are up for it you can try contributing it 😄. We are here of course for guidance and help. |
@DavidWylie, your source listing seems to miss some characters, so just to double check: you mean to have a |
I would like this feature too and as such I am willing to donate some time to do implement it. Any objections or can I get stuck straight in? |
I also think that this is interesting. I am only not sure about which approach is good to take. In any case @slukes I think that you can work on this if you want to. However, before starting I would suggest that you outline how the API would look like. If you ask me doing something like:
might be the way to go. The only thing is do we do this only for What did you have in mind @slukes? |
@filiphr: Do you have some special cases in mind where it make sense to write As just proposed in #1731 we may find a general way with a consistent approach for different, but similar, kind of mappings. |
The main use case I had in mind was actually mapping from a bean to a Map<String, Object> in essence to have the same effect as BeanUtils.describe(). I don't think this would require any special syntax as such? (I think I incorrectly jumped on this issue as being the same as what I wanted). It makes sense to implement the case @filiphr raises at the same time though. Regarding the syntax for that - In a map key you can literally any character in the key including ., [, ] what would we expect to happen here? Should there be some kind of escape sequence to allow for this in either case? |
Sorry, I want to ask, where does this feature go now? When can they be merged? |
Does mapstruct supports HashMap with value as List of objects ? as shown below , private Map<String, List> issues = null; with version as --> 1.3.0.Final |
I'm working on a pr for this. Not much progress last 2 months |
I would love to see this in action. But I see it is still open, have we reached anywhere near to the proposed solution? |
I've changed the title of this to reflect the functionality for mapping a Map from a Field. Since the functionality for mapping from a Map into a Field is part of 1.5.0.Beta1 done as part of #1075. |
I would love to see this in action. any progress on this feature? |
When using the mapstruct library for mapping dto objects to domain objects a common problem encountered is the ability to map Hashmaps to object properties.
Existing code to acheive this is to use a custom function which will get a hashmap index from the map and return it.
proposed syntax.
is this something already being investigated or considered?
The text was updated successfully, but these errors were encountered: