I'm using GIN to create MVP activities and their views. In some activities, I am able to inject private members--interfaces for GWT.create() and POJO singletons--while in other activities these same object type members are null in my start() method.
Below the member Messsages is an interface that extends com.google.gwt.i18n.client.Messages (a GWT.create()-able object), while the view is injected from my GIN module using `bind(MotdView.class).to(MotdViewGwtImpl.class).in(Singleton.class);`. This injection works:
@Inject private Messages messages;
...
@Inject
public MotdActivity(MotdView view) {
super(view, "nav");
this.view = view;
}
Below BeanFactory is an interface that extends com.google.web.bindery.autobean.shared.AutoBeanFactory (a GWT.create()-able object) while AppState is a Singleton POJO. This injection works (the beanFactory can decode text from the server into an AutoBean):
@Inject private QueriesView view;
@Inject private BeanFactory beanFactory;
@Inject private AppState appState;
...
@Inject
public QueriesActivity() {}
However in the member injections below do NOT work--BeanFactory and AppState are null in my start() method:
@Inject private BeanFactory beanFactory;
@Inject private AppState appState;
...
@Inject
public QueryFormActivity(QueryFormView view, QueryFormPlace place) {
super(view, "nav");
this.view = view;
this.place = place;
...
For QueryFormActivity, the view and place are provided by my ActivityMapper:
if (place instanceof QueryFormPlace) {
return new QueryFormActivity(injector.getQueryFormView(),
(QueryFormPlace)place);
}
I can modify QueryFormActivity's new method and also pass the BeanFactory and AppState using the injector--that works--but why must I? Why aren't they injected as they were in QueriesActivity? Could the member injection be failing because place is not injected? Is there some rule set for when member inject doesn't work.