Are Java records supported in flow 24.3.3?

Not working with Vaadin 24.3.3
import com.vaadin.flow.component.grid.Grid;
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
import com.vaadin.flow.router.Route;

import java.util.Arrays;
import java.util.List;

@Route(“record-grid”)
public class RecordGridView extends VerticalLayout {

// Definiere ein einfaches Java-Record
public record Person(String name, int age) {}

public RecordGridView() {
    // Erstelle ein Vaadin Grid
    Grid<Person> grid = new Grid<>(Person.class);

    // Fülle das Grid mit Daten
    List<Person> people = Arrays.asList(
            new Person("Alice", 25),
            new Person("Bob", 30),
            new Person("Charlie", 22)
    );
    grid.setItems(people);

    // Füge das Grid zur Vaadin-View hinzu
    add(grid);
}

}

Just define the columns yourself. Grid auto-column and BeanBinder are working based on Beans.

I know that its possible with classes. Is it possible with records?

Nope

Thanks

It would be fine, if a message were written or an exception thrown.

The javadoc says “bean” tho :grimacing:

With VGrid (Viritin from add-on, since 2.6.1, currently syncing to Maven central) it works :sunglasses: flow-viritin/src/test/java/org/vaadin/firitin/RecordsWithGrid.java at v24 · viritin/flow-viritin · GitHub

Stop improving Viritin and improve Vaadin :joy:

This is more productive :sunglasses:

Hehe

I just wanted to use Record in Grid today. If I want to do that tomorrow, this is the way. In flow-components, my PR wil be closed after two years, because there might be a better way to support records in Grid :crazy_face:).

Seriously, though, Viritin is often an inspiration for Vaadin core features. The features might not make it in as-is, but it’s great to have a prototype with real-life users before committing to a design

Yeah I understand the intention :slightly_smiling_face: I just like Matti’s contribution to the core framework :innocent: