@Override public Module module() { return binder -> BQCoreModule.extend(binder).setProperties(properties); }
private Builder() { this.module = new BQCoreModule(); }
@Override public Module module() { return BQCoreModule.builder().args(args) .bootLogger(bootLogger) .shutdownManager(shutdownManager) .moduleSource(moduleSource).build(); }
@Override public void configure(Binder binder) { BQCoreModule.extend(binder) .initAllExtensions() .addValueObjectsDescriptors(createValueObjectsDescriptorsMap()) .addOption(createConfigOption()) .addCommand(HelpConfigCommand.class); // bind instances binder.bind(BootLogger.class).toInstance(Objects.requireNonNull(bootLogger)); binder.bind(ShutdownManager.class).toInstance(Objects.requireNonNull(shutdownManager)); binder.bind(String[].class).annotatedWith(Args.class).toInstance(Objects.requireNonNull(args)); // too much code to create config factory.. extracting it in a provider // class... binder.bind(ConfigurationFactory.class).toProvider(JsonNodeConfigurationFactoryProvider.class).in(Singleton.class); }
@Override public void configure(Binder binder) { BQCoreModule.extend(binder) .initAllExtensions() .addOption(createConfigOption()) .addCommand(HelpConfigCommand.class); // bind instances binder.bind(BootLogger.class).toInstance(Objects.requireNonNull(bootLogger)); binder.bind(ShutdownManager.class).toInstance(Objects.requireNonNull(shutdownManager)); binder.bind(String[].class).annotatedWith(Args.class).toInstance(Objects.requireNonNull(args)); // deprecated, kept for those users who may have injected this in their own code binder.bind(Duration.class).annotatedWith(ShutdownTimeout.class) .toInstance(Objects.requireNonNull(Duration.ofMillis(10000L))); // too much code to create config factory.. extracting it in a provider // class... binder.bind(ConfigurationFactory.class).toProvider(JsonNodeConfigurationFactoryProvider.class).in(Singleton.class); }
@Override public void configure(Binder binder) { BQCoreModule.extend(binder) .addCommand(ServerCommand.class); binder.bind(HttpHandler.class) .annotatedWith(RootHandler.class) .to(DefaultHandler.class) .in(Singleton.class); }
@Override public Module module() { return BQCoreModule.builder().args(args) .bootLogger(bootLogger) .shutdownManager(shutdownManager) .moduleSource(moduleSource).build(); }
private Builder() { this.module = new BQCoreModule(); }
/** * @param binder DI binder passed to the Module that invokes this method. * @return {@link Multibinder} for Bootique options. * @since 0.12 * @deprecated since 0.22 use {@link #extend(Binder)} to get an extender object, and * then call {@link BQCoreModuleExtender#addOption(OptionMetadata)}. */ @Deprecated public static Multibinder<OptionMetadata> contributeOptions(Binder binder) { return extend(binder).contributeOptions(); }
/** Create an extended from the given binder. * * @param binder the injection binder. * @return the variable declarator. */ public static VariableDecls extend(Binder binder) { return new VariableDecls(io.bootique.BQCoreModule.extend(binder)); }
/** * @param binder DI binder passed to the Module that invokes this method. * @return {@link Multibinder} for Bootique commands. * @since 0.12 * @deprecated since 0.22 use {@link #extend(Binder)} to get an extender object, and * then call {@link BQCoreModuleExtender#addCommand(Class)}. */ @Deprecated public static Multibinder<Command> contributeCommands(Binder binder) { return extend(binder).contributeCommands(); }
/** * @param binder DI binder passed to the Module that invokes this method. * @return {@link MapBinder} for Bootique properties. * @see EnvironmentProperties * @since 0.12 * @deprecated since 0.22 use {@link #extend(Binder)} to get an extender object, and * then call {@link BQCoreModuleExtender#setProperty(String, String)}. */ @Deprecated public static MapBinder<String, String> contributeProperties(Binder binder) { return extend(binder).contributeProperties(); }
/** * @param binder DI binder passed to the Module that invokes this method. * @return {@link MapBinder} for values emulating environment variables. * @see EnvironmentVariables * @since 0.17 * @deprecated since 0.22 use {@link #extend(Binder)} to get an extender object, and * then call {@link BQCoreModuleExtender#setVar(String, String)}. */ @Deprecated public static MapBinder<String, String> contributeVariables(Binder binder) { return extend(binder).contributeVariables(); }
/** * Initializes optional default command that will be executed if no explicit command is matched. * * @param binder DI binder passed to the Module that invokes this method. * @param command an instance of the default command. * @since 0.20 * @deprecated since 0.22 use {@link #extend(Binder)} to get an extender object, and * then call {@link BQCoreModuleExtender#setDefaultCommand(Command)}. */ @Deprecated public static void setDefaultCommand(Binder binder, Command command) { extend(binder).setDefaultCommand(command); }
/** * Binds an optional application description used in help messages, etc. * * @param description optional application description used in help messages, etc. * @param binder DI binder passed to the Module that invokes this method. * @since 0.20 * @deprecated since 0.22 use {@link #extend(Binder)} to get an extender object, and * then call {@link BQCoreModuleExtender#setApplicationDescription(String)}. */ @Deprecated public static void setApplicationDescription(Binder binder, String description) { extend(binder).setApplicationDescription(description); }
/** * Initializes optional default command that will be executed if no explicit command is matched. * * @param binder DI binder passed to the Module that invokes this method. * @param commandType a class of the default command. * @since 0.20 * @deprecated since 0.22 use {@link #extend(Binder)} to get an extender object, and * then call {@link BQCoreModuleExtender#setDefaultCommand(Class)}. */ @Deprecated public static void setDefaultCommand(Binder binder, Class<? extends Command> commandType) { extend(binder).setDefaultCommand(commandType); }
/** * Provides a way to set default log levels for specific loggers. These settings can be overridden via Bootique * configuration of whatever logging module you might use, like bootique-logback. This feature may be handy to * suppress chatty third-party loggers, but still allow users to turn them on via configuration. * * @param binder DI binder passed to the Module that invokes this method. * @return {@link MapBinder} for Bootique properties. * @since 0.19 * @deprecated since 0.22 use {@link #extend(Binder)} to get an extender object, and * then call {@link BQCoreModuleExtender#setLogLevel(String, Level)}. */ @Deprecated public static MapBinder<String, Level> contributeLogLevels(Binder binder) { return extend(binder).contributeLogLevels(); }
@Override protected void configure() { // Name of the application. bind(String.class).annotatedWith(DefaultApplicationName.class).toInstance(Constants.PROGRAM_NAME); // Short description of the application. extend(binder()).setApplicationDescription(Messages.SarlcApplicationModule_0); // Long description of the application. bind(String.class).annotatedWith(ApplicationDetailedDescription.class).toProvider(LongDescriptionProvider.class).in(Singleton.class); // Synopsis of the application's arguments. bind(String.class).annotatedWith(ApplicationArgumentSynopsis.class).toInstance(Messages.SarlcApplicationModule_1); }
@Override protected void configure() { extend(binder()).addCommand(ExtraLanguageListCommand.class); }
@Override protected void configure() { extend(binder()).setDefaultCommand(CompilerCommand.class); }