Using dozer for copying java objects
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<Str开发者_Python百科ing,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,
NarendraEDIT 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.
精彩评论