Router layout

I am using Vaadin 14.0.3. I have a class MainLayout with a method someCode. I am using this class as layout for another class named MainView. Is it possible to use the method someCode in MainView? Here’s the example:

public class MainLayout {
	public void someCode() {

@Route(value = "main", layout = MainLayout.class)
public class MainView {	


I think the easiest way would be to make MainLayout injectable and inject it into MainView.