Skip to content

Instantly share code, notes, and snippets.

@baldram
Last active February 13, 2016 19:34
Show Gist options
  • Save baldram/b05cb07af90d549e45d9 to your computer and use it in GitHub Desktop.
Save baldram/b05cb07af90d549e45d9 to your computer and use it in GitHub Desktop.
Client-Side Bean Manager. Example of looking up beans through the use of the lookupBeans() method implemented in generic way. Example usage: SomeViewType mapView = getView(SomeViewType.class);More here: http://docs.jboss.org/errai/3.2.2.Final/errai/reference/html_single/#d0e3223
@Inject
private SyncBeanManager manager;
public <T extends Composite> T getView(Class<T> type) {
T view = null;
IOCBeanDef<T> bean = manager.lookupBean(type);
if (bean != null) {
view = bean.getInstance();
}
return view;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment