public abstract class Option extends Parameter
The default list separator is JSAP.DEFAULT_LISTSEPARATOR, which is defined as the platform's path separator character (":" on *nix and ";" on DOS/Windows as described above).
Flagged
,
Option
Constructor and Description |
---|
Option(String id)
Creates a new Option with the specified unique ID.
|
Modifier and Type | Method and Description |
---|---|
char |
getListSeparator()
Returns the current list separator character for this Option.
|
StringParser |
getStringParser()
Returns the StringParser to which this Option will delegate calls to its
parse() method, or null if
no StringParser is currently defined.
|
protected void |
internalSetList(boolean isList)
Sets whether this Option is a list.
|
protected void |
internalSetListSeparator(char listSeparator)
Sets the list separator character for this Option.
|
protected void |
internalSetRequired(boolean required)
Sets whether this Option is required.
|
protected void |
internalSetStringParser(StringParser stringParser)
Sets the StringParser to which this Option's parse() method should
delegate.
|
boolean |
isList()
Returns a boolean indicating whether this Option is a list.
|
protected List |
parse(String arg)
Parses the specified argument, returning the results in an ArrayList.
|
protected void |
register()
Informs this Option's StringParser that this Option is being registered
with a JSAP.
|
boolean |
required()
Returns a boolean indicating whether this Option is required.
|
protected void |
unregister()
Informs this Option's StringParser that this Option is being
unregistered
from a JSAP.
|
_setDefault, _setDefault, _setUsageName, addDefault, enforceParameterLock, getDefault, getHelp, getID, getSyntax, getUsage, getUsageName, locked, setHelp, setLocked
public Option(String id)
id
- the unique ID for this Option.protected final void internalSetList(boolean isList)
isList
- if true, this Option is a list.public final boolean isList()
protected final void internalSetListSeparator(char listSeparator)
listSeparator
- the list separator for this Option.public final char getListSeparator()
protected final void internalSetRequired(boolean required)
required
- if true, this Option will be required.public final boolean required()
protected final void internalSetStringParser(StringParser stringParser)
stringParser
- the StringParser to which this Option's parse()
method should delegate.StringParser
public final StringParser getStringParser()
protected final List parse(String arg) throws ParseException
parse
in class Parameter
arg
- the argument to parse.ParseException
- if the specified argument (or one of its tokens,
in the case of a list) cannot
be parsed.protected void register() throws JSAPException
JSAPException
- if the underlying StringParser throws it.StringParser.setUp()
protected void unregister()
StringParser.tearDown()
Copyright © 2015. All rights reserved.