Question

I am new to dozer framework. I want to copy some objects to a Map using dozer.

For instance Belwo is the example scenario which reflects my requirement.

  public void createUser(String userId,String password,String firstname)
  {
      Map<String,String> userMap=new HashMap<String,String>();

      userMap.put("LoginId",userId);
      userMap.put("password",password);
      userMap.put("FirstName",firstName);

      createUSerInApp(userMap);
   }.

I want to automatically copy the required properties like userId,password,firstname into userMap using dozer.

Can any one give any suggestions.

Thanks,
Narendra

Was it helpful?

Solution

EDIT 1

I was wrong!!!

Check this out. You can specify the key in your map for the property, should work like a charm. :)

I could be wrong, but I know of no built in functionality to perform the mapping you describe, so I think it will take a Custom Converter. Dozer really has great documentation.

I do highly recomend dozer. It may seem like more work setting it up, and learning it, but you have a hold of it (it won't take long to learn) it's really flexible and easy to maintain.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top