Instances of this interface are returned by the "fluent interface" methods to allow retrieval of option arguments in a type-safe manner. Here's an example:
OptionParser parser = new OptionParser();
OptionSpec<Integer> count =
parser.accepts( "count" ).withRequiredArg().ofType( Integer.class );
OptionSet options = parser.parse( "--count", "2" );
assert options.has( count );
int countValue = options.valueOf( count );
assert countValue == count.value( options );
List<Integer> countValues = options.valuesOf( count );
assert countValues.equals( count.values( options ) );
Modifier and Type | Method and Description |
---|---|
public boolean | Returns: whether this option is designated as a "help" optionTells whether this option is designated as a "help" option. |
public List | |
public V | |
public List |
isForHelp | back to summary |
---|---|
public boolean isForHelp() Tells whether this option is designated as a "help" option. The presence of a "help" option on a command line means that missing "required" options will not cause parsing to fail.
|
options | back to summary |
---|---|
public List |
value | back to summary |
---|---|
public V value(OptionSet detectedOptions) Gives the argument associated with the given option in the given set of detected options. Specifying a default argument value for this option will cause this method to return that default value even if this option was not detected on the command line, or if this option can take an optional argument but did not have one on the command line.
|
values | back to summary |
---|---|
public List Gives any arguments associated with the given option in the given set of detected options. Specifying a default argument value for this option will cause this method to return that default value even if this option was not detected on the command line, or if this option can take an optional argument but did not have one on the command line.
|