Java 类io.dropwizard.cli.EnvironmentCommand 实例源码

项目:dropwizard-guicey    文件:CommandSupport.java   
/**
 * 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.
 *
 * @param commands registered commands
 * @param injector guice injector object
 * @param tracker  stats tracker
 */
public static void initCommands(final List<Command> commands, final Injector injector,
                                final StatsTracker tracker) {
    final Stopwatch timer = tracker.timer(CommandTime);
    if (commands != null) {
        for (Command cmd : commands) {
            if (cmd instanceof EnvironmentCommand) {
                injector.injectMembers(cmd);
            }
        }
    }
    timer.stop();
}
项目:dropwizard-guicey    文件:CommandItemInfoImpl.java   
@Override
public boolean isEnvironmentCommand() {
    return EnvironmentCommand.class.isAssignableFrom(getType());
}