jargs.gnu

Class CmdLineParser.Option

Enclosing Class:
CmdLineParser
Known Direct Subclasses:
CmdLineParser.Option.BooleanOption, CmdLineParser.Option.DoubleOption, CmdLineParser.Option.IntegerOption, CmdLineParser.Option.LongOption, CmdLineParser.Option.StringOption, CustomOptionTest.ShortDateOption, CustomOptionTestCase.ShortDateOption

public static abstract class CmdLineParser.Option
extends java.lang.Object

Representation of a command-line option

Nested Class Summary

static class
CmdLineParser.Option.BooleanOption
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

Constructor Summary

Option(String longForm, boolean wantsValue)
Option(char shortForm, String longForm, boolean wantsValue)

Method Summary

Object
getValue(String arg, Locale locale)
String
longForm()
protected Object
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

Constructor Details

Option

protected Option(String longForm,
                 boolean wantsValue)

Option

protected Option(char shortForm,
                 String longForm,
                 boolean wantsValue)

Method Details

getValue

public final Object getValue(String arg,
                             Locale locale)
            throws CmdLineParser.IllegalOptionValueException

longForm

public String longForm()

parseValue

protected Object parseValue(String arg,
                            Locale locale)
            throws CmdLineParser.IllegalOptionValueException
Override to extract and convert an option value passed on the command-line

shortForm

public String shortForm()

wantsValue

public boolean wantsValue()
Tells whether or not this option wants a value

Copyright © 2001-2003 Steve Purcell. Copyright © 2002 Vidar Holen. Copyright © 2002 Michal Ceresna. Copyright © 2005 Ewan Mellor. Released under the terms of the BSD licence.