Comments (9)
If you can give me a hint where to start I'd even volunteer to implement it myself. I already did a lot of reading in the code but found that so many components are involved the property mapping. I just could not figure out if the architecture would be able to take the change, or if it needed some redesign.
from modelmapper.
I haven't thought much about it yet, but probably quite a few things would need to change to get this working. Currently the mapping process more or less copies/converts data from the source object to the destination object one property at a time, according to mappings. Figuring out what those mappings should be or allowing a user to define them is probably the bulk of what ModelMapper does. With your use case, there might not be a need for mappings per se. I'm not sure where I'd start to tackle this right now so just dig in and let me know if you have any specific Qs...
from modelmapper.
Today I am thinking a bit different about the problem. Probably Java is just not the right hammer for this nail. We started experimenting with mixed Java/Groovy projects. While a mapper in Java certainly needs tools like Dozer or ModelMapper, Groovy seems to offer the solution out of the box.
Automatic strict mapping from/to maps and beans is a standard feature in Groovy. So the problems we still need to solve is wether Java/Groovy integration is working as expected and if mapping customization is easy enough. For the latter I do not see a big risk.
We will check into it the next days and either work with you on this here or close the feature request.
On Sep 28, 2012, at 1:06 AM, Jonathan Halterman [email protected] wrote:
I haven't thought much about it yet, but probably quite a few things would need to change to get this working. Currently the mapping process more or less copies/converts data from the source object to the destination object one property at a time, according to mappings. Figuring out what those mappings should be or allowing a user to define them is probably the bulk of what ModelMapper does. With your use case, there might not be a need for mappings per se. I'm not sure where I'd start to tackle this right now so just dig in and let me know if you have any specific Qs...
—
Reply to this email directly or view it on GitHub.
from modelmapper.
I would love this feature as well since it makes it quite easy to read json straight into the objects were using with the mapper instead of configuring a full class structure in between just to do the json reading and then mapping this after.
from modelmapper.
@klausmyrseth Can you provide some more info on what this would look like or how you think it should work?
from modelmapper.
Merged into issue #43
from modelmapper.
I'm close to a release on this feature, but one thing worth mentioning is the scenario described in shouldMapBeanToMap()
above might not be supported. The reason is, there's not really any property mapping involved here. Typically ModelMapper matches the structure of a source model to the structure of a destination model. Since the destination here is an empty Map, there's no structure there to match against the source model. So the best we can do is simply copy the source into the destination exactly as it is. Is this what you desire?
from modelmapper.
I see this is closed, but I am unable to map a pojo to a map as in shouldMapBeanToMap() above. Is it safe to assume that was never implemented?
from modelmapper.
I just tried this and it does not populate the map. I think based on the ticket the idea is to have the key be the field and value the value of the field. Currently this does not work.
Regards,
from modelmapper.
Related Issues (20)
- why modelMapper doesn't work to copy complex data from the same Entity? HOT 1
- ModelMapper cannot map all fields when mapping from proxy class over interface HOT 1
- ModelMapper mapping is updating table primary key instead of foreign key. HOT 1
- Error mapping, then reboot, works for a while
- How to skip not loaded Lazy fields?
- Test fails after upgrading from 3.1.0 to 3.1.1
- Java 21 support HOT 18
- Support of Java Module System
- Custom mapping in nested objects HOT 4
- Skip field of generic class HOT 1
- Mapping Source object to Destination object
- Mapping nested generic object with generic HOT 1
- Use specific converter for one field
- Model Mapper does not map values correctly (Intermittent - once in a few tries)
- Model Mapper Low performance
- Jackson Module: @JsonTypeInfo support for automatically handling inheritance HOT 1
- ModelMapper fails to map nested entity user field HOT 1
- When condition does not work for null-field
- How to ignore mapping errors HOT 1
- ModelMapper not working with nested generics
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from modelmapper.