When binding fields to a bean there are two ways:
Use a
FieldGroup
and wrap the bean in aBeanItem
:final FieldGroup fieldGroup = new FieldGroup(new BeanItem<DataBean>(dataBean));
Use a
BeanFieldGroup
, in this case the bean will also be wrapped into aBeanItem
under the hoods:final BeanFieldGroup<DataBean> beanBinder = new BeanFieldGroup<>(DataBean.class); beanBinder.setItemDataSource(dataBean);
IMHO using a FieldGroup
is actually simpler, is there any advantage in using a BeanFieldGroup
?