Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8610691
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:11:29+00:00 2026-06-12T04:11:29+00:00

There is a question on my mind for a while. Let’s say we have

  • 0

There is a question on my mind for a while. Let’s say we have the following classes:

public Class Person{
    String name;
    String address;
    String description;
}

public Class PersonFacade{
    String name;
    String address;
    String desc;
}

as you can see the only difference between these two classes are the name of one variable. My question is what is the best way to write a helper class to map the values of one object to another object. Let’s assume we have the following:

Person person = new Person();
person.name="name1";
person.address="address1";
person.description="description1";

I want to write a class that is supposed to do the following (let’s call it Transformer class)

PersonFacade personFacade = new PersonFacade();
TransformClass.transformFrom(person, personFacade);

What I want this TransformClass.transformFrom() method to do is the follwoing:

based on the similarity of the variable names, assign the value of the variable from “FromClass” to “ToClass”
so in our case, I want it to assign personFacade.name = "name1", personFacade.address="adderss1" and personFacade.desc = "description1" (this last one seems harder to accomplish, but let’s try)

Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T04:11:30+00:00Added an answer on June 12, 2026 at 4:11 am

    You can use Dozer:

    Dozer is a Java Bean to Java Bean mapper that recursively copies data
    from one object to another. Typically, these Java Beans will be of
    different complex types.

    Dozer supports simple property mapping, complex type mapping,
    bi-directional mapping, implicit-explicit mapping, as well as
    recursive mapping. This includes mapping collection attributes that
    also need mapping at the element level.

    Look at this: http://dozer.sourceforge.net/

    It’s a great JavaBean Mapper.

    Here the “Getting Started”:

    http://dozer.sourceforge.net/documentation/gettingstarted.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

As a huge fan of C++, there have been a question in my mind.
I have a question in my mind from last many days, that while writing
Here is my question - There are two classes Order and PaymentType . An
I have a job interview tomorrow and I'm trying to answer this question: There
Simple question: Is there a class or interface that encapulates the getting of a
I don't have a specific scenario in mind, but this question just crossed my
This question came into my mind while generating sample data for a SO-answer. I
Let's say I have an array of floating point numbers, in sorted (let's say
Let's say I have a two subclasses of UIViewController called MasterViewController and DetailViewController .
A question I have been thinking about for a while - would Stackoverflow users

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.