vadbch / orika

Automatically exported from code.google.com/p/orika
0 stars 0 forks source link

Add the possibiliy to copy field by reference #168

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Hi,

I know about registering a PassThroughConverter for a specific class in order 
to copy references instead of deep cloning objects.

But, it implies to do always the same action for the same clases.

Would it be nice to have something like that :

mapperFactory.classMap(PersonSource.class, PersonDestination.class)
    .field("firstName", "givenName")
    .field("lastName", "sirName")
    .copy("personalDetails", "details")
    .byDefault()
    .register();

Where "copy" just generate this code: 
destination.setDetails(source.getDetails());

I know that "map" and "copy" will be synonym for immutable classes ... but it 
will be easier to control the way the whole cloning is done.

Thanks for the great tool.

--

Grégory Fernandez

Original issue reported on code.google.com by lgri...@gmail.com on 10 Jul 2014 at 5:55