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.

Reply via email to