Class CommandSupport
java.lang.Object
ru.vyarus.dropwizard.guice.module.installer.internal.CommandSupport
Provides support for commands injection support and classpath scanning resolution of commands.
- Since:
- 01.09.2014
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidinitCommands(List<io.dropwizard.core.cli.Command> commands, com.google.inject.Injector injector, StatsTracker tracker) Inject dependencies into all registered environment commands.static List<io.dropwizard.core.cli.Command>registerCommands(io.dropwizard.core.setup.Bootstrap bootstrap, ClasspathScanner scanner, ConfigurationContext context) Scans classpath to find commands and register them.
-
Method Details
-
registerCommands
public static List<io.dropwizard.core.cli.Command> registerCommands(io.dropwizard.core.setup.Bootstrap bootstrap, ClasspathScanner scanner, ConfigurationContext context) Scans classpath to find commands and register them. Commands are instantiated using default constructor, butEnvironmentCommandmust have constructor withApplicationargument.- Parameters:
bootstrap- bootstrap objectscanner- configured scanner instancecontext- configuration context- Returns:
- list of installed commands
-
initCommands
public static void initCommands(List<io.dropwizard.core.cli.Command> commands, com.google.inject.Injector injector, StatsTracker tracker) 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 commandsinjector- guice injector objecttracker- stats tracker
-