Interface DynamicOptions.ModulesClassNamesProvider

  • All Superinterfaces:
    DynamicOptions.ClassNameProvider, DynamicOptions.DynamicBean
    Enclosing class:
    DynamicOptions

    public static interface DynamicOptions.ModulesClassNamesProvider
    extends DynamicOptions.ClassNameProvider
    To provide additional Guice bindings for options to a command in another classloader, bind a ModulesClassNamesProvider which provides the name of your Modules needed for your DynamicBean in the other classLoader.

    Do this by binding to the name of the command you are going to bind to and providing an Iterable of Module names to instantiate and add to the Injector used to instantiate the DynamicBean in the other classLoader. For example:

       bind(com.google.gerrit.server.DynamicOptions.DynamicBean.class)
           .annotatedWith(Exports.named(
               "com.google.gerrit.plugins.otherplugin.command"))
           .to(MyOptionsModulesClassNamesProvider.class);
    
       static class MyOptionsModulesClassNamesProvider implements DynamicOptions.ClassNameProvider {
         @Override
         public String getClassName() {
           return "com.googlesource.gerrit.plugins.myplugin.CommandOptions";
         }
         @Override
         public Iterable getModulesClassNames()() {
           return "com.googlesource.gerrit.plugins.myplugin.MyOptionsModule";
         }
       }