Package com.martiansoftware.jsap
Class Option
java.lang.Object
com.martiansoftware.jsap.Parameter
com.martiansoftware.jsap.Option
- Direct Known Subclasses:
FlaggedOption,UnflaggedOption
public abstract class Option extends Parameter
The base class from which FlaggedOption and UnflaggedOption are derived.
An Option is a Parameter
that requires some information (unlike a Switch whose mere presence is
significant).
Options may be declared as lists, or multiple values separated by a delimiting character. An example of a list option might be a classpath, which is a collection of paths separated by a ":" on *nix systems and a ";" on DOS/Windows systems. JSAP automatically separates list options into multiple tokens before calling their StringParsers' parse() method.
Options may be declared as lists, or multiple values separated by a delimiting character. An example of a list option might be a classpath, which is a collection of paths separated by a ":" on *nix systems and a ";" on DOS/Windows systems. JSAP automatically separates list options into multiple tokens before calling their StringParsers' parse() method.
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).
- Author:
- Marty Lamb
- See Also:
Flagged,Option
-
Constructor Summary
Constructors Constructor Description Option(java.lang.String id)Creates a new Option with the specified unique ID. -
Method Summary
Modifier and Type Method Description chargetListSeparator()Returns the current list separator character for this Option.StringParsergetStringParser()Returns the StringParser to which this Option will delegate calls to its parse() method, or null if no StringParser is currently defined.booleanisList()Returns a boolean indicating whether this Option is a list.booleanrequired()Returns a boolean indicating whether this Option is required.Methods inherited from class com.martiansoftware.jsap.Parameter
addDefault, getDefault, getHelp, getID, getSyntax, getUsage, getUsageName, setHelpMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
Option
public Option(java.lang.String id)Creates a new Option with the specified unique ID.- Parameters:
id- the unique ID for this Option.
-
-
Method Details
-
isList
public final boolean isList()Returns a boolean indicating whether this Option is a list.- Returns:
- a boolean indicating whether this Option is a list.
-
getListSeparator
public final char getListSeparator()Returns the current list separator character for this Option.- Returns:
- the current list separator character for this Option.
-
required
public final boolean required()Returns a boolean indicating whether this Option is required.- Returns:
- a boolean indicating whether this Option is required.
-
getStringParser
Returns the StringParser to which this Option will delegate calls to its parse() method, or null if no StringParser is currently defined.- Returns:
- the StringParser to which this Option will delegate calls to its parse() method, or null if no StringParser is currently defined.
-