Can't get Vaadin grid examples to compile

Hi

I’m following https://vaadin.com/components/vaadin-grid/java-examples/using-components but can’t get past the line:


// Use the component constructor that accepts an item ->
// new PersonComponent(Person person)
grid.addComponentColumn(PersonComponent::new).setHeader("Person");

**

Error:(121, 38) java: incompatible types: invalid constructor reference
incompatible types: java.lang.Object cannot be converted to Person

**

Have anyone else this problem or does the demos work for you?

Hi.

Are you using the Grid as Grid<Person> and did you copy the objects from the bottom of https://vaadin.com/components/vaadin-grid/java-examples # Grid example model (Person and Address)

Next you would want to copy the objects PersonComponent and PersonCard from the https://vaadin.com/components/vaadin-grid/java-examples/using-components

By doing these steps the only thing that’s not there for me is: createItems()
This method only creates a List of 500 Person beans.

  • Mikael

Hi Mikael,
I have my own Person object. It looks the same but without “static” as my JDK8 environment didn’t allow it…

Yes the static needs to be dropped if it’s in its own file.
The static is there as for the demo it is a nested class inside the Demo class.

  • Mikael