I've just started a project built with the new GWT archetype.
ActivityMapper looks like:
public interface Factory {
HomeActivity homeActivity();
GreetingActivity greetingActivity(String user);
}
private final Factory factory;
@Inject
MainActivityMapper(Factory factory) {
this.factory = factory;
}
@Override
public Activity getActivity(Place place) {
if (place instanceof HomePlace) {
return factory.homeActivity();
}
if (place instanceof GreetingPlace) {
GreetingPlace greetingPlace = (GreetingPlace) place;
return factory.greetingActivity(greetingPlace.getUser());
}
logger.severe("Unhandled place type: " + place.getClass().getName());
return null;
}
I'm now trying to implement code split with AsyncProvider based on this example, but I can't get it working.
When using ActivityAsyncProxy, what should I do? return the ActivityAsyncProxy from getActivity(Place place)? but then, how can I create the ActivityAsyncProxy from the factory?
How would you suggest to make the activity mapper play nicely with code split?