public abstract static class CmdLineParser.Option<T> extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
CmdLineParser.Option.BooleanOption
An option that expects a boolean value
|
static class |
CmdLineParser.Option.DoubleOption
An option that expects a floating-point value
|
static class |
CmdLineParser.Option.IntegerOption
An option that expects an integer value
|
static class |
CmdLineParser.Option.LongOption
An option that expects a long integer value
|
static class |
CmdLineParser.Option.StringOption
An option that expects a string value
|
| Modifier and Type | Field and Description |
|---|---|
private String |
longForm |
private String |
shortForm |
private boolean |
wantsValue |
| Modifier | Constructor and Description |
|---|---|
protected |
Option(char shortForm,
String longForm,
boolean wantsValue) |
protected |
Option(String longForm,
boolean wantsValue) |
private |
Option(String shortForm,
String longForm,
boolean wantsValue) |
| Modifier and Type | Method and Description |
|---|---|
protected T |
getDefaultValue()
Override to define default value returned by getValue if option does not want
a value
|
T |
getValue(String arg,
Locale locale) |
String |
longForm() |
protected T |
parseValue(String arg,
Locale locale)
Override to extract and convert an option value passed on the command-line
|
String |
shortForm() |
boolean |
wantsValue()
Tells whether or not this option wants a value
|
private final String shortForm
private final String longForm
private final boolean wantsValue
protected Option(String longForm, boolean wantsValue)
protected Option(char shortForm,
String longForm,
boolean wantsValue)
public String shortForm()
public String longForm()
public boolean wantsValue()
public final T getValue(String arg, Locale locale) throws CmdLineParser.IllegalOptionValueException
protected T parseValue(String arg, Locale locale) throws CmdLineParser.IllegalOptionValueException
protected T getDefaultValue()
Copyright © 2019 David R. Smith. All rights reserved.