Git Product home page Git Product logo

Comments (9)

pvblivs avatar pvblivs commented on July 3, 2024

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.

jhalterman avatar jhalterman commented on July 3, 2024

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.

pvblivs avatar pvblivs commented on July 3, 2024

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.

klausmyrseth avatar klausmyrseth commented on July 3, 2024

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.

jhalterman avatar jhalterman commented on July 3, 2024

@klausmyrseth Can you provide some more info on what this would look like or how you think it should work?

from modelmapper.

jhalterman avatar jhalterman commented on July 3, 2024

Merged into issue #43

from modelmapper.

jhalterman avatar jhalterman commented on July 3, 2024

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.

garyschulte avatar garyschulte commented on July 3, 2024

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.

marklester avatar marklester commented on July 3, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.