/** * Declares a new CLI option, associating its presence with a configuration resource. This way a single option * can be used to enable a complex configuration. * * @param configResourceId a resource path compatible with {@link io.bootique.resource.ResourceFactory} denoting * a configuration source. E.g. "a/b/my.yml", or "classpath:com/foo/another.yml". * @param name the name of the new CLI option. * @return this extender instance * @since 0.24 * @deprecated since 0.25. The new way of adding an option associated with a config file is by separately declaring * an option and then associating it with one or more configs via {@link #addConfigOnOption(String, String)}. */ @Deprecated public BQCoreModuleExtender addConfigResourceOption(String configResourceId, String name) { contributeOptions().addBinding().toInstance( OptionMetadata.builder(name) .configResource(configResourceId) .valueOptional() .build()); return this; }
/** * Declares a new CLI option, associating it with a config path. The option runtime value is assigned to the * configuration property denoted by the path. Default value provided here will be used if the option is present, * but no value is specified on the command line. * * @param configPath a dot-separated "path" that navigates configuration tree to the desired property. E.g. * "jdbc.myds.password". * @param defaultValue default option value * @param name the name of the new CLI option. * @return this extender instance * @since 0.24 */ public BQCoreModuleExtender addOption(String configPath, String defaultValue, String name) { contributeOptions().addBinding().toInstance( OptionMetadata.builder(name) .configPath(configPath) .defaultValue(defaultValue) .valueOptional() .build()); return this; }
MessageFormat.format(Messages.CompilerConfigModule_0, ENCODING_OPTION)) .configPath(FILE_ENCODING_NAME) .valueOptional(Messages.CompilerConfigModule_1) .defaultValue(Charset.defaultCharset().displayName()) .build()); Messages.CompilerConfigModule_2) .configPath(JAVA_VERSION_NAME) .valueOptional(Messages.CompilerConfigModule_3) .defaultValue(SARLVersion.MINIMAL_JDK_VERSION) .build()); MessageFormat.format(Messages.CompilerConfigModule_4, JavaCompiler.getDefault().toJsonString())) .configPath(JAVA_COMPILER_NAME) .valueOptional(jcompilerValues) .defaultValue(JavaCompiler.getDefault().toJsonString()) .build()); MessageFormat.format(Messages.CompilerConfigModule_6, Boolean.TRUE)) .configPath(OUTPUT_TRACES_NAME) .valueOptional(trueFalseValues) .defaultValue(Boolean.TRUE.toString()) .build()); MessageFormat.format(Messages.CompilerConfigModule_7, Boolean.TRUE)) .configPath(OUTPUT_STORAGES_NAME) .valueOptional(trueFalseValues) .defaultValue(Boolean.TRUE.toString()) .build());
public Builder valueOptional() { return valueOptional(""); }
public Builder valueOptional() { return valueOptional(""); }
/** * Marks value optional and sets the default value for this option that will be used if the option is provided on * command line without an explicit value. * * @param valueName a description of value * @param defaultValue a default value for the option. * @return this builder instance * @since 1.0.RC1 */ public Builder valueOptionalWithDefault(String valueName, String defaultValue) { this.option.defaultValue = defaultValue; return valueOptional(valueName); }