Tutorial :convert HashMap to JavaBean instance given javabean class



Question:

is there a utility out there for creating a bean (which has simple String attributes whose name match with HashMap keys ) given bean class as input along with properly set hashmap?

thanks, Amit


Solution:1

Apache Commons BeanUtils should be able to help you - since it's used for "bean" operations by many other frameworks. A "DynaBean" looks close to that.


Solution:2

My suggestion is to go for Dozer. I have been using it (for 3 years) for map-bean transformation and it works great. It also integrates well with Spring


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »