Vaadin8 grid nested property error

I’m trying to create a grid with a nested property. But I can not find a way to show nested property field in grid column.

private Component buildGrid() {
branchGrid = new Grid<>(Branch.class);
branchGrid.setItems(DummyData.allBranches);
branchGrid.setSelectionMode(Grid.SelectionMode.SINGLE);
branchGrid.setSizeFull();
branchGrid.getEditor().setEnabled(false);
branchGrid.addComponentColumn((ValueProvider<Branch, Component>) branch -> {
Button btnEdit = new Button(VaadinIcons.EDIT);
btnEdit.addStyleName(MaterialTheme.BUTTON_CUSTOM + " " + MaterialTheme.BUTTON_BORDER);
btnEdit.setDescription("Click for edit!"); return btnEdit; }).setId("edit");
branchGrid.setColumnOrder("edit", "branchId", "branchName", "email", "phone", "location", "owner", "active");
return branchGrid;
}

public class Branch {
private String branchId; 
private String branchName;
private String email;
private String phone;
private String location;
private User owner;
private boolean active;
}

public class User {
private long userId;
private String username;
private String password;
private String email;
}

I want to just show user.username in grid. But in this code, show all user object stack reference or else.
like this:
com.meyrasoft.checkupbox.model.User@12703bc

How can I show owner filed as username in grid column?

There is a simple way for this solution. If we define

Grid branchGrid

, we should to use addColumn() definition like below.

 private Component buildGrid() {
    
            Grid<Branch> branchGrid = new Grid<>();
            branchGrid.setItems(DummyData.allBranches);
            branchGrid.setSelectionMode(Grid.SelectionMode.SINGLE);
            branchGrid.setSizeFull();
            branchGrid.getEditor().setEnabled(false);
    
            branchGrid.addComponentColumn((ValueProvider<Branch, Component>) branch -> {
                Button btnEdit = new Button(VaadinIcons.EDIT);
                btnEdit.addStyleName(MaterialTheme.BUTTON_CUSTOM + " " + MaterialTheme.BUTTON_BORDER);
                btnEdit.setDescription("Click for edit!");
                return btnEdit;
            }).setId("edit");
    
            branchGrid.addColumn(b -> b.getBranchId()).setCaption("Branch Id");
            branchGrid.addColumn(b -> b.getBranchName()).setCaption("Branch Name");
            branchGrid.addColumn(b -> b.getEmail()).setCaption("E-Mail");
            branchGrid.addColumn(b -> b.getPhone()).setCaption("Phone");
            branchGrid.addColumn(b -> b.getLocation()).setCaption("Location");
            branchGrid.addColumn(b -> String.valueOf(b.getOwner().getUsername())).setCaption("Owner");
            branchGrid.addColumn(b -> b.isActive()).setCaption("Active Status");
    
            return branchGrid;
}