Re: Having trouble mapping into an existing object.

445 views
Skip to first unread message

Jonathan Halterman

unread,
May 7, 2014, 8:15:03 PM5/7/14
to model...@googlegroups.com
Hi Ryan,

I'm not sure where your original message went either. I think google may have swallowed this one as well (it thinks pastebin is spam). But anyways, thanks for bringing this up - I created an issue to track it. Right now I'm making sure I understand all of the cases where this could occur before I commit a fix.

Cheers,
Jonathan


On Mon, May 5, 2014 at 8:30 AM, Ryan <ry...@jaeb.ca> wrote:
Hi,

I apologize if this hits the list twice.  My original seems to have disappeared.

I'm trying to sync between two objects of the same type, but having trouble.  Here is an example:


If I use ModelMapper to create a new object, it's properly mapped.  If I re-use a destination object that was previously created by ModelMapper, it works.  However, if I manually create a new destination, ModelMapper doesn't seem to be able to update it.  Does it have something to do with the JavaFX style properties I'm using?  Is there a way I can get ModelMapper to sync those types of objects for me?

Ryan

--
You received this message because you are subscribed to the Google Groups "modelmapper" group.
To unsubscribe from this group and stop receiving emails from it, send an email to modelmapper...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jonathan Halterman

unread,
May 7, 2014, 8:42:33 PM5/7/14
to model...@googlegroups.com
Pushed the fix. You should be good - let me know otherwise.

- jonathan
To unsubscribe from this group and stop receiving emails from it, send an email to modelmapper+unsubscribe@googlegroups.com.

Michiel

unread,
Jun 5, 2014, 10:41:07 PM6/5/14
to model...@googlegroups.com
Hi Jonathan,

In what release should this be available?

I downloaded 0.6.5 and in my case the example provided didn't work as well.

What I noticed as well is the other map operation in the example (mapper.map(source, Person.class) only copies references of the objects and doesn't provide a clone operation as might be expected. Is there a reason not to clone the object ? 

Michiel
To unsubscribe from this group and stop receiving emails from it, send an email to modelmapper...@googlegroups.com.

Jonathan Halterman

unread,
Jun 6, 2014, 12:15:58 AM6/6/14
to model...@googlegroups.com
Hi Michiel,

The fix for this particular issue#104, hasn't been released yet. I've been working on a few major features, but can push a minor release with this if you'd like.

ModelMapper isn't really intended for cloning objects, rather it's designed to map data via the easiest possible mechanism, which includes copying references where possible. There may be ways to force ModelMapper to clone values instead of copying references, but it's something I haven't really looked into yet.

Cheers,
Jonathan
Reply all
Reply to author
Forward
0 new messages