Class SimplePropertySet<T>

java.lang.Object
org.dellroad.stuff.vaadin24.data.SimplePropertySet<T>
Type Parameters:
T - underlying target type
All Implemented Interfaces:
PropertySet<T>, Serializable
Direct Known Subclasses:
MapPropertySet

public class SimplePropertySet<T> extends Object implements PropertySet<T>
Straightforward implementation of PropertySet using caller-supplied getters and setters.

This class is useful for building arbitrary property sets, e.g., see MapPropertySet.

It's also useful when you need to detect Java bean properties defined by default interface methods. Due to JDK-8071693, Vaadin's Binder fails to detect such bean properties. To work around that bug, you can do something like this:


     // Gather bean properties using Spring's BeanUtils to work around JDK-8071693
     final SimplePropertySet<T> propertySet = new SimplePropertySet<>(beanType);
     Stream.of(BeanUtils.getPropertyDescriptors(beanType))
       .filter(pd -> !(pd instanceof IndexedPropertyDescriptor))
       .filter(pd -> pd.getReadMethod() != null)
       .filter(pd -> pd.getWriteMethod() != null)
       .forEach(propertySet::addPropertyDefinition);

     // Create binder
     final Binder<T> binder = Binder.withPropertySet(propertySet);
 

This class allows you to recover the original property definition from a Binder.Binding instance; see propertyDefinitionForBinding().

Does not support sub-properties.

See Also: