You might consider using a MapBinder instead of @Named, and then @Inject Map<String, Provider<Template>>. Leigh.
On Oct 21, 9:16 am, Patrick Lightbody <[email protected]> wrote: > Bob, > Cool - that's what I was thinking was the "right" way to do it, but > was just curious if there was another way > > Patrick > > On Oct 21, 7:58 am, Bob Lee <[email protected]> wrote: > > > On Wed, Oct 21, 2009 at 9:31 AM, Patrick Lightbody > > <[email protected]>wrote: > > > > But then I was thinking, it'd be cool if I could somehow @Inject this: > > > > @Named("foo.vm") Provider<Template> templateProvider > > > ... > > > Template template = templateProvider.get(); > > > > Then my provider would somehow be able to detect that it should be > > > associated with "foo.vm" and return the right value. > > > > Is something like this possible? > > > We usually encourage developers to bind things explicitly up front. That > > way, we can catch errors ASAP. In this case, you might consider iterating > > over all of your .vm files and creating bindings to them (I'd probably drop > > the ".vm" part). > > > Bob --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
