Comment by toucansam99:
To answer my own question, one method is to use the java `ServiceLoader`.
I did something like the following, where I had a `PluginGuiceModule`
interface that extends `Module`, and an `OverridingModule` annotation:
{{{
List<Module> modules = Lists.newArrayList();
List<Module> overridingModules = Lists.newArrayList();
modules.add(new MainModule());
ServiceLoader<PluginGuiceModule> pluginModules =
ServiceLoader.load(PluginGuiceModule.class);
for (PluginGuiceModule pluginModule : pluginModules) {
if (pluginModule.getClass().getAnnotation(OverridingModule.class) !=
null) {
overridingModules.add(pluginModule);
} else {
modules.add(pluginModule);
}
}
return Modules.override(modules).with(overridingModules);
}}}
For more information:
http://code.google.com/p/google-guice/wiki/Multibindings
--
You received this message because you are subscribed to the Google Groups
"google-guice-dev" 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-dev?hl=en.