How to convert
List<Object[]> to List<POJOObject>
Here is example
//So, lets us say I have Object[], I want to have a class as follows:
class POJOObject {
//maps to Object[0]
private Integer x;
//maps to Object[1]
private Long y;
//maps to Object[2]
private String y;
}
Is there any easy way to do that? What library can be useful here?
Thanks.
Maybe http://dozer.sourceforge.net can help you. It is a mapping library configurable by xml.
I tried it shortly with this:
My mappings.xml looks like this:
Unfortunately it only mapped 10 to all three PojoObject properties. Maybe you can see the error and use the snippet for your code. Maybe it is a bug in Dozer... I couldn't find any example using
this[0]
.