BeanItem - Automatically add Nested Properties

Hi all!
Can BeanItem automatically adds nested properties?
I think that would be useful, if it iterates recursivelly, and add all nested properties.

Latter, you can bind to Property editors only what you want.

Exist such feature?

Thanks all!

In the general case, this cannot be done safely and recursively the way BeanItem works (adding the properties in advance) - you would need restrictions on what kind of beans can be used to avoid cycles etc. Furthermore, there is some overhead to scanning for properties and adding them. You could perhaps have your own item class that expands properties when used at runtime, though.

AbstractBeanContainer has methods for adding nested properties (one at a time). For a BeanItem outside a container, you can to build a utility for this yourself, adding NestedMethodProperty instances based on the bean structure. I believe you can do it with about 10-20 lines of code if you know you won’t have loops etc. for your bean types.

In Vaadin 7 alpha 1, there is also BeanItem.expandProperty(propertyId) which does this on one level (not recursively), as well as AbstractBeanContainer.addNestedContainerBean() which replaces a property with its subproperties.