Package jargs.gnu
Class CmdLineParser.Option
- java.lang.Object
-
- jargs.gnu.CmdLineParser.Option
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
CmdLineParser.Option.BooleanOption,CmdLineParser.Option.DoubleOption,CmdLineParser.Option.IntegerOption,CmdLineParser.Option.LongOption,CmdLineParser.Option.StringOption
- Enclosing class:
- CmdLineParser
public abstract static class CmdLineParser.Option extends Object implements Serializable
Representation of a command-line option.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCmdLineParser.Option.BooleanOptionThe Class BooleanOption.static classCmdLineParser.Option.DoubleOptionAn option that expects a floating-point value.static classCmdLineParser.Option.IntegerOptionAn option that expects an integer value.static classCmdLineParser.Option.LongOptionAn option that expects a long integer value.static classCmdLineParser.Option.StringOptionAn option that expects a string value.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ObjectgetValue(String arg, Locale locale)Gets the value.StringlongForm()Long form.protected ObjectparseValue(String arg, Locale locale)Override to extract and convert an option value passed on the command-line.StringshortForm()Short form.booleanwantsValue()Tells whether or not this option wants a value.
-
-
-
Constructor Detail
-
Option
protected Option(String longForm, boolean wantsValue)
Instantiates a new option.- Parameters:
longForm- the long formwantsValue- the wants value
-
Option
protected Option(char shortForm, String longForm, boolean wantsValue)Instantiates a new option.- Parameters:
shortForm- the short formlongForm- the long formwantsValue- the wants value
-
-
Method Detail
-
shortForm
public String shortForm()
Short form.- Returns:
- the string
-
longForm
public String longForm()
Long form.- Returns:
- the string
-
wantsValue
public boolean wantsValue()
Tells whether or not this option wants a value.- Returns:
- true, if successful
-
getValue
public final Object getValue(String arg, Locale locale) throws CmdLineParser.IllegalOptionValueException
Gets the value.- Parameters:
arg- the arglocale- the locale- Returns:
- the value
- Throws:
CmdLineParser.IllegalOptionValueException- the illegal option value exception
-
parseValue
protected Object parseValue(String arg, Locale locale) throws CmdLineParser.IllegalOptionValueException
Override to extract and convert an option value passed on the command-line.- Parameters:
arg- the arglocale- the locale- Returns:
- the object
- Throws:
CmdLineParser.IllegalOptionValueException- the illegal option value exception
-
-