|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.martiansoftware.jsap.Parameter
com.martiansoftware.jsap.Option
com.martiansoftware.jsap.UnflaggedOption
An option whose meaning is derived from its position in the argument list rather than a flag that precedes it. UnflaggedOptions allow the parsing of command lines without flags, such as "compressfiles destinationFile file1 file2 file3 file4 ...", where "destinationFile" is the name of the file to create, and file1 through file 4 (and beyond) are the names of the files to compress. The JSAP that supports this command line has only two options defined: the first accepts a single destination file, and the second is "greedy," consuming the remaining unflagged options.
FlaggedOption
,
Option
Constructor Summary | |
UnflaggedOption(String id)
Creates a new UnflaggedOption with the specified unique ID. |
|
UnflaggedOption(String id,
StringParser stringParser,
boolean required,
String help)
A shortcut constructor that creates a new non-greedy UnflaggedOption with no default value and configures its most commonly used settings. |
|
UnflaggedOption(String id,
StringParser stringParser,
String defaultValue,
boolean required,
boolean greedy)
A shortcut constructor that creates a new UnflaggedOption and configures its most commonly used settings. |
|
UnflaggedOption(String id,
StringParser stringParser,
String defaultValue,
boolean required,
boolean greedy,
String help)
A shortcut constructor that creates a new UnflaggedOption and configures its most commonly used settings. |
Method Summary | |
String |
getSyntax()
Returns syntax instructions for this FlaggedOption. |
boolean |
isGreedy()
Returns a boolean indicating whether this UnflaggedOption is greedy. |
UnflaggedOption |
setDefault(String defaultValue)
Sets a default value for this parameter. |
UnflaggedOption |
setDefault(String[] defaultValues)
Sets one or more default values for this parameter. |
UnflaggedOption |
setGreedy(boolean greedy)
Sets whether this UnflaggedOption is greedy. |
UnflaggedOption |
setList(boolean isList)
Sets whether this UnflaggedOption is a list. |
UnflaggedOption |
setListSeparator(char listSeparator)
Sets the list separator character for this UnflaggedOption. |
UnflaggedOption |
setRequired(boolean required)
Sets whether this UnflaggedOption is required. |
UnflaggedOption |
setStringParser(StringParser stringParser)
Sets the StringParser to which this UnflaggedOption's parse() method should delegate. |
UnflaggedOption |
setUsageName(String usageName)
Sets the name that will be displayed when getUsage() is called |
Methods inherited from class com.martiansoftware.jsap.Option |
getListSeparator, getStringParser, isList, required |
Methods inherited from class com.martiansoftware.jsap.Parameter |
addDefault, getDefault, getHelp, getID, getUsage, getUsageName, setHelp |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public UnflaggedOption(String id)
id
- the unique ID for this UnflaggedOption.public UnflaggedOption(String id, StringParser stringParser, String defaultValue, boolean required, boolean greedy, String help)
id
- the unique ID for this UnflaggedOptionstringParser
- the StringParser this UnflaggedOption should use.defaultValue
- the default value for this UnflaggedOption (may be
null).required
- if true, this UnflaggedOption is required.greedy
- if true, this UnflaggedOption is greedy.help
- the help text for this option (may be set to JSAP.NO_HELP
for none).public UnflaggedOption(String id, StringParser stringParser, String defaultValue, boolean required, boolean greedy)
id
- the unique ID for this UnflaggedOptionstringParser
- the StringParser this UnflaggedOption should use.defaultValue
- the default value for this UnflaggedOption (may be
null).required
- if true, this UnflaggedOption is required.greedy
- if true, this UnflaggedOption is greedy.public UnflaggedOption(String id, StringParser stringParser, boolean required, String help)
id
- the unique ID for this UnflaggedOptionstringParser
- the StringParser this UnflaggedOption should use.required
- if true, this UnflaggedOption is required.help
- the help text for this option (may be set to JSAP.NO_HELP
for none).Method Detail |
public UnflaggedOption setGreedy(boolean greedy)
greedy
- if true, this UnflaggedOption will be greedy.
public UnflaggedOption setUsageName(String usageName)
usageName
- the name to use, or null if the id should be used (default)
public boolean isGreedy()
public String getSyntax()
getSyntax
in class Parameter
public UnflaggedOption setList(boolean isList)
isList
- if true, this Option is a list.
public UnflaggedOption setListSeparator(char listSeparator)
listSeparator
- the list separator for this Option.
public UnflaggedOption setRequired(boolean required)
required
- if true, this Option will be required.
public UnflaggedOption setStringParser(StringParser stringParser)
stringParser
- the StringParser to which this Option's parse()
method should delegate.
StringParser
public UnflaggedOption setDefault(String defaultValue)
defaultValue
- the default value for this parameter.setDefault(String)
public UnflaggedOption setDefault(String[] defaultValues)
defaultValues
- the default values for this parameter.setDefault(String)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |