BeanItem order

Hello!

I’m using the BeanItem for Form generation with FieldGroup. The problem is, that the BeanItem contains the properties in alphabetical order, but I need them in the same order as they are in the POJO.
I need to generate really huge forms, so the manual ordering method is out of options.

Thx for your help!

Hi,

The BeanItem properties are acquired by reflection with the BeanInfo.getPropertyDescriptors() method. It looks like the method does not guarantee any particular order - especially the declaration order. It may use the Class.getMethods() and other such lower-level reflection methods that also do not guarantee the order. I don’t know if it’s in
any way possible
to get the methods in order by reflection in Java.

Well, parsing the source files to determine the order is always possible. If they are written by strict coding conventions, you should be able to parse them with just a simple regexp parser or something.