Folks,

I'm trying to make GWT 2.1 MVP work nicely with GIN. It looks like this use
case was specifically considered when
creating PlaceHistoryMapperWithFactory, but no such thing seems to exist for
ActivityMapper. There is a passing reference to using Gin in
DevGuideMvpActivitiesAndPlaces.html , where it says "... ClientFactory is
used by HelloActivity to obtain a reference to the HelloView as well as the
EventBus and PlaceController. Any of these could alternatively be injected
via GIN." and also when it says "A better way to implement the chain of
nested ifs would be with a GIN module", in reference to ActivityMapper.

The problem, however, is that we cannot both inject application-level
objects (EventBus, PlaceController, etc) and also pass the Place as
constructor arguments to the Activity. We could have all of the dependencies
for every Activity (like all the views) injected into our ActivityMapper and
pass them thru, but this leaks a lot of details into what should be a very
simple mapper class. If done incorrectly, it would also cause code-splitting
issues.

One way around this is to inject a Provider<MyActivity> or
AsyncProvider<MyActivity> in the ActivityMapper and then do something like
myActivityProvider.get().initPlace(place) - which is like the assisted
injection that's discussed in the Guice docs. I'm wondering if there's a
more elegant way that was considered?

Additionally, I'm not sure I understand how to "implement the chain of
nested ifs" in a GIN module. This sounds like a great idea, but what did you
have in mind to make GIN do this for us? We can have GIN differentiate on a
bunch of things (annotations, generics, interfaces, etc), but I don't know
how you could replace the if-block with GIN. Could someone point me in the
right direction here?

Thanks,
Tolga

-- 
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to