Class CommandSupport


  • public final class CommandSupport
    extends java.lang.Object
    Provides support for commands injection support and classpath scanning resolution of commands.
    Since:
    01.09.2014
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void initCommands​(java.util.List<io.dropwizard.cli.Command> commands, com.google.inject.Injector injector)
      Inject dependencies into all registered environment commands.
      static java.util.List<io.dropwizard.cli.Command> registerCommands​(io.dropwizard.setup.Bootstrap bootstrap, ClasspathScanner scanner, ConfigurationContext context)
      Scans classpath to find commands and register them.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • registerCommands

        public static java.util.List<io.dropwizard.cli.Command> registerCommands​(io.dropwizard.setup.Bootstrap bootstrap,
                                                                                 ClasspathScanner scanner,
                                                                                 ConfigurationContext context)
        Scans classpath to find commands and register them. Commands are instantiated using default constructor, but EnvironmentCommand must have constructor with Application argument.
        Parameters:
        bootstrap - bootstrap object
        scanner - configured scanner instance
        context - configuration context
        Returns:
        list of installed commands
      • initCommands

        public static void initCommands​(java.util.List<io.dropwizard.cli.Command> commands,
                                        com.google.inject.Injector injector)
        Inject dependencies into all registered environment commands. (only field and setter injection could be used) There is no need to process other commands, because only environment commands will run bundles and so will start the injector.
        Parameters:
        commands - registered commands
        injector - guice injector object