RE: Vaadin 8 Grid: What is the replacement for CellStyleGenerator?

The replacement is the
Column::setStyleGenerator
method:

grid.getColumn(“firstName”).setStyleGenerator(item → {…});

In other words, how do i fix this:

protected void initCellStyleGenerator(ImmutableList<ColumnDefinition> rightAlignedCols) {

    setCellStyleGenerator((CellStyleGenerator) cellReference -> {

        String propertyId = String.valueOf(cellReference.getPropertyId());
        List<String> names = new ArrayList<>();
        for (ColumnDefinition def : rightAlignedCols) {
            names.add(def.getName());
        }

        if (names.contains(propertyId)) {
            // when the current cell is number such as age, align text to right
            return "v-align-right";
        }
        return "v-align-left";
    });
}