On Jan 8, 3:01 am, Thomas Broyer <
t.bro...@gmail.com> wrote:
> Using GIN, it means you'd @Inject Provider<?>s [.... ] for your activities into your ActivityManager (so that
> an activity is instantiated each time you call the Provider's get() method),
- do you mean injecting providers into "ActivityMappers" ? or
"ActivityManagers" ?
- your comment on Provider vs Factories
just to make sure if I understood your correctly,
if we have a Provider and want to pass Activity specific parameters
to it,
this would not be possible with GIN Providers, right ?
because GIN Providers have one get() methods, and not possible to pass
parameters.
that is why we have to use Factories instead of GIN Providers?
- following on a related question I asked in another post,[1]
lets say we are keeping a map of all of our application activities,
which is @injected
in a class(Registry) at application startup through a GIN Provider
that puts all activity instances in that map;
this approach would result in early instantiation of all activities.
right ?
if we instead relied on ActivityProviders, and keeping a map of all of
our ActivityProviders instead (rather than activity instances
themselves),
it appears we are deferring the early instantiation of Activities.
But injecting ActivityProviders will result in Activity Instantiation,
for example in the code below,
if we @Inject MyActivityProvider at startup in a class, MyActivity is
alo instantiated right away, right ? (constructor injection)
in cases where we have 150 Activities, for each of them an
ActivityProvider, therefore 150 ActivityProviders, (somehow organized)
and injecting these ActivityProviders upfront in a class(registry) at
application startup, will it result in rightaway instantiation of all
our Activities as well ?
// we are defining an ActivityProvider for each of our Activities
public class MyActivityAProvider implements Provider<MyActivityA> {
private final MyActivityA myActivityA;
@Inject
MyActivityAProvider(MyActivityA myActivityA){
this.myActivityA = myActivityA;
}
MyActivityA get(){
return myActivityA;
}
}
https://groups.google.com/group/google-web-toolkit/browse_thread/thread/00a5e77a84b29202/bdf104ac34ac16db?hl=en#bdf104ac34ac16db