I need to take a pojo, which may contain simple or complex datatypes like arraylists and convert it into a "string bean". This string bean must contain string equivalents for the attributes in the pojo.
For example, the pojo could be:
The "string bean" would then be:
I need to do this conversion at runtime.
I tried using the byte code manipulation library Javassist to do this and I am facing an issue. I can dynamically convert a class which contains simple types and Strings to a "string bean", however, javassist doesn't seem to let me generate a class with an array or arraylist field. Does anyone know how to dynamically generate arrays and arraylists using Javassist or some other approach? More broadly, does anyone know a good way to dynamically generate classes which include array and arraylist fields.
I have started researching some other byte code manipulation libraries like ASM and BCEL but they seem to be a little more difficult to use than Javassist.