Class BeanDataGenerator<T>

java.lang.Object
com.vaadin.flow.data.provider.BeanDataGenerator<T>
Type Parameters:
T - the type of the bean to be serialized to the client
All Implemented Interfaces:
DataGenerator<T>, Serializable

public class BeanDataGenerator<T> extends Object implements DataGenerator<T>
A DataGenerator that sends all the fields of the objects in the model to the client, using the field names as property names.

This class is useful for the cases when the properties in the template of the columns have the same name as the fields of the model object in the server side.

Note: this generator sends the entire bean to the client, even if the template in the client doesn't use all the properties.

For objects without inner properties, like Strings, a property called value is created in the model, so it can be accessed via [[item.value]] in the template.

Since:
1.2
Author:
Vaadin Ltd.
See Also:
  • Constructor Details

    • BeanDataGenerator

      public BeanDataGenerator()
  • Method Details

    • generateData

      public void generateData(T item, elemental.json.JsonObject data)
      Description copied from interface: DataGenerator
      Adds custom data for the given item to its serialized JsonObject representation. This JSON object will be sent to client-side DataProvider.
      Specified by:
      generateData in interface DataGenerator<T>
      Parameters:
      item - the data item being serialized
      data - the JSON object being sent to the client