@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); }
/** * Declares a configuration variable for the given config path and given name. * * @param configPath a dot-separated "path" that navigates through the configuration tree to the property that * should be bound form a variable. E.g. "jdbc.myds.password". * @param name public name of the variable. * @return this extender instance. */ public BQCoreModuleExtender declareVar(String configPath, String name) { return declareVar(configPath, name, null); }
/** * Returns an instance of {@link BQCoreModuleExtender} used by downstream modules to load custom extensions to the * Bootique core module. Should be invoked from a downstream Module's "configure" method. * * @param binder DI binder passed to the Module that invokes this method. * @return an instance of {@link BQCoreModuleExtender} that can be used to load custom extensions to the Bootique * core. * @since 0.22 */ public static BQCoreModuleExtender extend(Binder binder) { return new BQCoreModuleExtender(binder); }
@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 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 protected void configure() { extend(binder()) .addOption(OptionMetadata.builder( CompilerCommand.PROGRESS_OPTION_NAME, Messages.CompilerCommandModule_0) .configPath(ProgressBarConfig.ENABLE) .defaultValue(Boolean.TRUE.toString()) .build()); extend(binder()).addCommand(CompilerCommand.class); binder().bindListener(new BindingMatcher(), new LoggerProvisionListener( binder().getProvider(ProgressBarConfig.class))); }
/** * 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); }
@Override protected void configure() { // Binding a dummy class to trigger eager init of Log4j as // @Provides below can not be invoked eagerly. binder().bind(LogInitTrigger.class).asEagerSingleton(); VariableDecls.extend(binder()).declareVar(LEVEL); extend(binder()).addOption(OptionMetadata.builder( "log", //$NON-NLS-1$ Locale.getString("LOG_OPT", Level.getLabels())) //$NON-NLS-1$ .configPath(LEVEL) .valueRequired(Locale.getString("LEVEL")) //$NON-NLS-1$ .build()); }
@Override protected void configure() { VariableDecls.extend(binder()).declareVar(OUTPUT_PATH_NAME); extend(binder()).addOption(OptionMetadata.builder( Constants.SARL_OUTPUT_DIRECTORY_OPTION, MessageFormat.format(Messages.SarlcConfigModule_0, Constants.PROGRAM_NAME, extend(binder()).addOption(OptionMetadata.builder( Constants.JAVA_OUTPUT_DIRECTORY_OPTION, MessageFormat.format(Messages.SarlcConfigModule_6, Constants.PROGRAM_NAME, extend(binder()).addOption(OptionMetadata.builder( "workingdir", Messages.SarlcConfigModule_2) //$NON-NLS-1$ .configPath(WORKING_PATH_NAME) VariableNames.toEnvironmentVariableName(CLASSPATH_NAME), CLASSPATH_SHORT_OPTION, CLASSPATH_LONG_OPTION); extend(binder()).addOptions(OptionMetadata.builder( CLASSPATH_LONG_OPTION, cpDescription) .configPath(CLASSPATH_NAME) extend(binder()).addOption(OptionMetadata.builder( "bootclasspath", //$NON-NLS-1$ MessageFormat.format(Messages.SarlcConfigModule_5, File.pathSeparator)) extend(binder()).addOption(OptionMetadata.builder( "generator", //$NON-NLS-1$ MessageFormat.format(Messages.SarlcConfigModule_7,
/** * 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); }
@Override protected void configure() { extend(binder()).addCommand(ExtraLanguageListCommand.class); }
/** * 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); }
@Override protected void configure() { VariableDecls.extend(binder()).declareVar(IGNORE_WARNINGS_NAME); extend(binder()).addOption(OptionMetadata.builder( "nowarn", Messages.ValidatorConfigModule_0) //$NON-NLS-1$ .configPath(IGNORE_WARNINGS_NAME) .build()); VariableDecls.extend(binder()).declareVar(ALL_WARNINGS_NAME); extend(binder()).addOption(OptionMetadata.builder( "wall", Messages.ValidatorConfigModule_2) //$NON-NLS-1$ .configPath(ALL_WARNINGS_NAME) .build()); VariableDecls.extend(binder()).declareVar(ALL_ERRORS_NAME); extend(binder()).addOption(OptionMetadata.builder( "werror", Messages.ValidatorConfigModule_1) //$NON-NLS-1$ .configPath(ALL_ERRORS_NAME) .build()); }
@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(VersionCommand.class); }
@Override protected void configure() { extend(binder()).setDefaultCommand(CompilerCommand.class); }
@Override protected void configure() { VariableDecls.extend(binder()).declareVar(FILE_ENCODING_NAME); extend(binder()).addOption(OptionMetadata.builder( ENCODING_OPTION, MessageFormat.format(Messages.CompilerConfigModule_0, ENCODING_OPTION)) extend(binder()).addOption(OptionMetadata.builder( "javasource", //$NON-NLS-1$ Messages.CompilerConfigModule_2) extend(binder()).addOption(OptionMetadata.builder( "javacompiler", //$NON-NLS-1$ MessageFormat.format(Messages.CompilerConfigModule_4, JavaCompiler.getDefault().toJsonString())) Boolean.TRUE.toString(), Boolean.FALSE.toString()); VariableDecls.extend(binder()).declareVar(OUTPUT_TRACES_NAME); extend(binder()).addOption(OptionMetadata.builder( "writetraces", //$NON-NLS-1$ MessageFormat.format(Messages.CompilerConfigModule_6, Boolean.TRUE)) extend(binder()).addOption(OptionMetadata.builder( "writestorages", //$NON-NLS-1$ MessageFormat.format(Messages.CompilerConfigModule_7, Boolean.TRUE)) extend(binder()).addOption(OptionMetadata.builder( "generateinlines", //$NON-NLS-1$ MessageFormat.format(Messages.CompilerConfigModule_8, extend(binder()).addOption(OptionMetadata.builder(
/** Declare an environment variable which is linked to the given Bootique variable, and has its name defined * from the name of the Bootique variable. * * @param bootiqueVariable the name of the bootique variable. * @return the Bootique extender. */ public VariableDecls declareVar(String bootiqueVariable) { this.extender.declareVar(bootiqueVariable, VariableNames.toEnvironmentVariableName(bootiqueVariable)); return this; }
/** * Returns an instance of {@link BQCoreModuleExtender} used by downstream modules to load custom extensions to the * Bootique core module. Should be invoked from a downstream Module's "configure" method. * * @param binder DI binder passed to the Module that invokes this method. * @return an instance of {@link BQCoreModuleExtender} that can be used to load custom extensions to the Bootique * core. * @since 0.22 */ public static BQCoreModuleExtender extend(Binder binder) { return new BQCoreModuleExtender(binder); }
@Override public void configure(Binder binder) { BQCoreModule.extend(binder).addCommand(EngineCommand.class); VertxModule.extend(binder).initAllExtensions(); }