-
-
Notifications
You must be signed in to change notification settings - Fork 979
Provide mapping into java.util.Map using enum values as key #717
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
If this feature is added I would suggest that the other way around should also be done. Meaning: Map -> Bean , Set -> Bean
additionally would be very usefull to use for HttpServletRequest e.g. |
I am looking for something similar (if not the same)
for example public class ClassA { public class ClassB { @mapping(target="properties(key='server name')", source="serverName") @mapping(target="serverName", source="properties(key='server name'") |
Similar functionality is available in Dozer: http://dozer.sourceforge.net/documentation/mapbackedproperty.html |
actually we are using dozer now. but its performance is not good. we are considering to move to either mapstruct or other tools. |
I would like to see this feature in MapStruct as well, if possible. |
People are supposed to be using https://github.com/FasterXML/jackson for that purpose. Never tested it! |
Instead of
where
Ignore duplicated keys / add flag
|
I'd like to map the fields of a bean class into a dictionary-like class, using MapStruct. My source class is a standard bean (simplified example):
Now I want to map these fields into a Map-like container:
In other words, I'd like MapStruct to generate something along the lines of:
I couldn't find anything similar in the MapStruct documentation. There is much flexibility for getting at mapping sources (nested sources, expressions), but for targets I can see only the
target = "propertyname"
notation which doesn't leave much room for flexibility.(original question from stackoverflow, added as issue as requested by Gunnar)
The text was updated successfully, but these errors were encountered: