Thanks everyone. I ended up using the @Provides provider method and a locator builder. Seemed like a very elegant solution in my case.
Thanks everyone again. Ilya On Fri, Mar 12, 2010 at 2:59 PM, Bob Lee <[email protected]> wrote: > Here's one way. Add this method to your module: > private <T extends Finder> void addFinder(Class<T> type) { > final Provider<T> finderProvider = getProvider(type); > requestInjection(new Object() { > �...@inject artifactlocator artifactLocator; > �...@inject addFinder() { > artifactLocator.addFinder(finderProvider.get()); > } > }); > } > Then add these lines: > addFinder(RaceTemplateFinder.class); > addFinder(EventTemplateFinder.class); > addFinder(ClasspathTemplateFinder.class); > Here's another approach that makes ArtifactLocator immutable: > �...@provides @Singleton ArtifactLocator provideArtifactLocator( > ArtifactLocator.Builder builder, RaceTemplateFinder a, > EventTemplateFinder b, ClasspathTemplateFinder c) { > return builder.add(a).add(b).add(c).build(); > } > Thanks, > 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. > -- 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.
