open class JOptCommandLinePropertySource : CommandLinePropertySource<OptionSet>
CommandLinePropertySource implementation backed by a JOpt OptionSet. Typical usage Configure and execute an OptionParser
against the String[]
of arguments supplied to the main
method, and create a JOptCommandLinePropertySource using the resulting OptionSet
object:
public static void main(String[] args) { OptionParser parser = new OptionParser(); parser.accepts("option1"); parser.accepts("option2").withRequiredArg(); OptionSet options = parser.parse(args); PropertySource ps = new JOptCommandLinePropertySource(options); // ... }
See CommandLinePropertySource for complete general usage examples.
Requires JOpt Simple version 4.3 or higher. Tested against JOpt up until 5.0.
Author
Chris Beams
Author
Juergen Hoeller
Author
Dave Syer
Since
3.1
See Also
CommandLinePropertySourcejoptsimple.OptionParserjoptsimple.OptionSet
JOptCommandLinePropertySource(options: OptionSet)
Create a new JOptCommandLinePropertySource(name: String, options: OptionSet)
Create a new |
static val COMMAND_LINE_PROPERTY_SOURCE_NAME: String
The default name given to CommandLinePropertySource instances: {@value} |
|
static val DEFAULT_NON_OPTION_ARGS_PROPERTY_NAME: String
The default name of the property representing non-option arguments: {@value} |
open fun getOptionValues(name: String): MutableList<String> |
|
open fun getPropertyNames(): Array<String> |
fun containsProperty(name: String): Boolean
This implementation first checks to see if the name specified is the special "non-option arguments" property, and if so delegates to the abstract |
|
fun getProperty(name: String): String
This implementation first checks to see if the name specified is the special "non-option arguments" property, and if so delegates to the abstract |
|
open fun setNonOptionArgsPropertyName(nonOptionArgsPropertyName: String): Unit
Specify the name of the special "non-option arguments" property. The default is {@value #DEFAULT_NON_OPTION_ARGS_PROPERTY_NAME}. |