private void register(View view) { if (view instanceof Widget) { ViewProxy<Widget> proxy = new ViewProxy<>((Widget) view, userSession); widgets.add(proxy); widgetsPerId.put(proxy.getId(), proxy); } else if (view instanceof Page) { ViewProxy<Page> proxy = new ViewProxy<>((Page) view, userSession); pagesPerId.put(proxy.getId(), proxy); pages.add(proxy); } }