|
||||||||||
| 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.Switch
A Switch is a parameter whose presence alone is significant; another
commonly used term for a Switch is "Flag".
Switches use a BooleanStringParser
internally, so their results can be
obtained from a JSAPResult using
the getBoolean() methods.
An example of a command line using a Switch is "dosomething -v", where "-v" might mean "verbose."
Flagged,
BooleanStringParser| Constructor Summary | |
Switch(String id)
Creates a new Switch with the specified unique ID. |
|
Switch(String id,
char shortFlag,
String longFlag)
A shortcut constructor that creates a new Switch and configures all of its settings. |
|
Switch(String id,
char shortFlag,
String longFlag,
String help)
A shortcut constructor that creates a new Switch and configures all of its settings, including help. |
|
| Method Summary | |
String |
getLongFlag()
Returns the long flag for this Switch. |
char |
getShortFlag()
Returns the short flag for this Switch. |
Character |
getShortFlagCharacter()
Returns the short flag for this Switch. |
String |
getSyntax()
Returns usage instructions for this Switch. |
Switch |
setDefault(String defaultValue)
Sets a default value for this parameter. |
Switch |
setDefault(String[] defaultValues)
Sets one or more default values for this parameter. |
Switch |
setLongFlag(String longFlag)
Sets the long flag for this Switch. |
Switch |
setShortFlag(char shortFlag)
Sets the short flag for this Switch. |
| 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 Switch(String id)
id - the unique ID for this Switch.
public Switch(String id,
char shortFlag,
String longFlag,
String help)
id - the unique ID for this Switch.shortFlag - the short flag for this Switch (may be set to
JSAP.NO_SHORTFLAG for none).longFlag - the long flag for this Switch (may be set to
JSAP.NO_LONGFLAG for none).help - the help text for this Switch (may be set to JSAP.NO_HELPfor none).
public Switch(String id,
char shortFlag,
String longFlag)
id - the unique ID for this Switch.shortFlag - the short flag for this Switch (may be set to
JSAP.NO_SHORTFLAG for none).longFlag - the long flag for this Switch (may be set to
JSAP.NO_LONGFLAG for none).| Method Detail |
public Switch setShortFlag(char shortFlag)
shortFlag - the short flag for this Switch.
public char getShortFlag()
getShortFlag in interface Flaggedpublic Character getShortFlagCharacter()
getShortFlagCharacter in interface Flaggedpublic Switch setLongFlag(String longFlag)
longFlag - the long flag for this Switch.
public String getLongFlag()
getLongFlag in interface Flaggedpublic String getSyntax()
getSyntax in class Parameterpublic Switch setDefault(String defaultValue)
defaultValue - the default value for this parameter.setDefault(String)public Switch 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 | |||||||||