Skip to content

Instantly share code, notes, and snippets.

@tophyr
Created July 16, 2014 18:14
Show Gist options
  • Save tophyr/ef2d4429a318079eb01a to your computer and use it in GitHub Desktop.
Save tophyr/ef2d4429a318079eb01a to your computer and use it in GitHub Desktop.
@Provides
Noodile provideNoodile(@Named("fooClaster") Claster foo, @Named("barClaster") Claster bar) {
...
}
// need to duplicate this function for fooClaster and barClaster? or can i specify that a fooClaster uses this with @Named("foo") Jeebus?
@Provides
Claster provideJeebus(Jeebus j) {
Claster c = new Claster(j);
// do a bunch of setup logic that doesn't change between Jeebi
return c;
}
@Provides @Named("foo")
Jeebus provideFooJebus() {
return new Jeebus("foo");
}
@Provides @Named("bar")
Jeebus provideBarJeebus() {
return new Jeebus("bar");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment