Web tier: servlets, JSP, Web frameworks: Generating Java Bean at runtime from hash map values

  1. Hi,

    I am trying to find out a way to create Java Bean instances at runtime, using a generic tool rather than calling 'getter/setter' methods and setting the values, may be by providing the input parameter as a hash map. I can ofcourse write create a framework, but is there any open source tool out there which I can use directly?

    Thanks in advance,
  2. Take a look at CGLib [http://cglib.sourceforge.net/]. I believe the net.sf.cglib.beans.BeanGenerator will do what you want.

    Here is a weblog with some hints: http://www.sixlegs.com/blog/index.html%3Fyear=2003&month=12.html