/** * 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(); }
@Override public boolean isEnvironmentCommand() { return EnvironmentCommand.class.isAssignableFrom(getType()); }