Interface DynamicOptions.DynamicBean

  • All Known Subinterfaces:
    DynamicOptions.BeanParseListener, DynamicOptions.ClassNameProvider, DynamicOptions.ModulesClassNamesProvider
    Enclosing class:
    DynamicOptions

    public static interface DynamicOptions.DynamicBean
    To provide additional options, bind a DynamicBean. For example:
       bind(com.google.gerrit.server.DynamicOptions.DynamicBean.class)
           .annotatedWith(Exports.named(com.google.gerrit.sshd.commands.Query.class))
           .to(MyOptions.class);
     
    To define the additional options, implement this interface. For example:
       public class MyOptions implements DynamicOptions.DynamicBean {
         @Option(name = "--verbose", aliases = {"-v"}
                 usage = "Make the operation more talkative")
         public boolean verbose;
       }
     

    The option will be prefixed by the plugin name. In the example above, if the plugin name was my-plugin, then the --verbose option as used by the caller would be --my-plugin--verbose.

    Additional options can be annotated with @RequiresOption which will cause them to be ignored unless the required option is present. For example:

       @RequiresOptions("--help")
       @Option(name = "--help-as-json",
               usage = "display help text in json format")
       public boolean displayHelpAsJson;