PropertysetItem personItem = new PropertysetItem();
You are generating an empty map, with no properties - which is different to a bean with null values for those properties. The FieldFactory will generated a field for each property in the Item - as the item is empty, no fields are generated.
Here’s some (untested) code to create an empty PropertysetItem that represents a Person as in the FormPojoExample
/* Create an empty "Person" item */
PropertysetItem item = new PropertysetItem();
item.addItemProperty("firstName", new ObjectProperty(null, String.class));
item.addItemProperty("lastName", new ObjectProperty(null, String.class));
item.addItemProperty("birthDate", new ObjectProperty(null, Date.class));
item.addItemProperty("password", new ObjectProperty(null, String.class));
item.addItemProperty("countryCode", new ObjectProperty(null, String.class));
/* Change some properties */
item.getItemProperty("firstName").setValue("Blessed R.");
item.getItemProperty("lastName").setValue("Geek");
/* Retrieve a property */
Date birthDate = (Date) item.getItemProperty("birthDate").getValue();
You can hide some properties that are in the container, but that you don’t want to show in form. IDs and such. You can also rearrange the form’s fields by specifying an order to that array.
Would mean that the form would only show the firstName and lastName properties. You can also change the order in which the properties are displayed; in this particular instance, we are setting all of the properties as visible - but, as Jens points out, we are ensuring that shoeSize and uuid come last. I would imagine that without specifiying the order, the order is “jvm-defined”, i.e. pretty useless.