2008/11/26 Dhanji R. Prasanna <[EMAIL PROTECTED]> > > Yes, you can do so with a Provider: > > http://google-guice.googlecode.com/svn/trunk/javadoc/com/google/inject/Provider.html > > A provider can be injected the same way as any other class, so you can > inject the dependencies on it, then pass them on to the sealed class. >
and in the next release of Guice you can also use provider methods: // taken from http://publicobject.com/2008/07/typeresolver-tells-you-what-listget.html class BarProviderMethods { @Provides @Singleton Bar provideBar() { Bar result = new Bar(); result.setBaz("hello"); return result; } // ...more provider methods... } for when you don't want to write a Provider class for each sealed class Dhanji. > > On Tue, Nov 25, 2008 at 11:19 AM, Artem B. <[EMAIL PROTECTED]> wrote: > > > > Hi all! > > > > I have a 3rd party library which is dependency injection-friendly but > > it's classes constructors are not annotated with @Inject? Can I still > > use Guice to fulfill the injection requests for the classes and inject > > the classes into my classes? > > > > thanx, Artem. > > > > > > > > > -- Cheers, Stuart --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "google-guice" 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-guice?hl=en -~----------~----~----~----~------~----~------~--~---
