Thanks for the info!

On Jul 21, 6:40 pm, Thomas Broyer <[email protected]> wrote:
> On Jul 22, 3:07 am, SD <[email protected]> wrote:
>
> > Is this correct?
>
> > So, if a class like AView is instantiated using UIBinder when doing a
> > createAndBind on an xml file that has a reference to AView, and Aview
> > has an @Singleton annotation, you can have a constructor in some
> > presenter class APresenter like
>
> > @Inject
> > public APresenter(AView aView) {...
>
> > and GIN this will not result in 2 AView objects?
>
> GIN and UiBinder don't know each other. GIN will only respect
> @Singleton for what it's asked to instantiate; it doesn't prevent you
> from doing a "new AView()" in your code, which is what UiBinder will
> generate.
> As said previously, if you want a real @Singleton, make sure only GIN
> instantiates the class; and to make it work with UiBinder use either
> @UiField(provided=true) or a @UiFactory method to give UiBinder your
> GIN-managed @Singleton, instead of letting it instantiate the object.
>
> > Also, could you use
>
> > @Inject
> > public APresenter(Provider<AView> aView) {...
>
> > What would be the difference (except for calling aView.get()) in these
> > 2 ways of handling things?
>
> Lazy-instantiation: AView is only instantiated when you call the
> provider's get(). If it's a @Singleton, then only the first call to
> get() will instantiate an AView and subsequent calls will return the
> singleton instance; but it is still true that no AView would have been
> instantiated before a call to get().

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to