Win a copy of liveProject: Protecting User Data with Spring Security and OAuth2 this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • paul wheaton
  • Devaka Cooray
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Piet Souris
  • salvin francis
  • Mikalai Zaikin
  • Himai Minh

Copy value from attribute a1 in class to attribute b1 in class using 0bject mapping

Ranch Hand
Posts: 281
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can anyone suggest a pragmatic way (e.g. use of object mappint e.g. Dozer, Smooky etc.) without writing code to copy properties from one object to another when the name of the properties may not match. If names of the properties did match in two objects ( and, I could have used copyProperties. I also do not want to write tedious code to copy value of attribute a1 from to value b1 in

Can you suggest of easy way of doing it using object mapping API of Dozer, Smooky etc.?

This is the problem:

Value of attribute a1 (which has public getter and setter) in class has to to be copied to the value of attribute b1 (which has public getter and setter) of class As the name of the attributes are different (a1 in and b1 in, I cannot use copyProperties. I also do not want to write tedious Java code to pass the value of a1 of to b1 of

Is it possible to set up Dozer, Smooky etc. that will copy value of a1 attribute of into b1 attribute of

If I can do that, I can only write configuration code to do so.

Any advice will be appreciated.
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic