public class Switch extends Parameter implements Flagged
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 and Description |
---|
Switch(java.lang.String id)
Creates a new Switch with the specified unique ID.
|
Switch(java.lang.String id,
char shortFlag,
java.lang.String longFlag)
A shortcut constructor that creates a new Switch and configures all of
its settings.
|
Switch(java.lang.String id,
char shortFlag,
java.lang.String longFlag,
java.lang.String help)
A shortcut constructor that creates a new Switch and configures all of
its settings, including help.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getLongFlag()
Returns the long flag for this Switch.
|
char |
getShortFlag()
Returns the short flag for this Switch.
|
java.lang.Character |
getShortFlagCharacter()
Returns the short flag for this Switch.
|
java.lang.String |
getSyntax()
Returns usage instructions for this Switch.
|
Switch |
setDefault(java.lang.String defaultValue)
Sets a default value for this parameter.
|
Switch |
setDefault(java.lang.String[] defaultValues)
Sets one or more default values for this parameter.
|
Switch |
setLongFlag(java.lang.String longFlag)
Sets the long flag for this Switch.
|
Switch |
setShortFlag(char shortFlag)
Sets the short flag for this Switch.
|
addDefault, getDefault, getHelp, getID, getUsage, getUsageName, setHelp
public Switch(java.lang.String id)
id
- the unique ID for this Switch.public Switch(java.lang.String id, char shortFlag, java.lang.String longFlag, java.lang.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_HELP
for none).public Switch(java.lang.String id, char shortFlag, java.lang.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).public Switch setShortFlag(char shortFlag)
shortFlag
- the short flag for this Switch.public char getShortFlag()
getShortFlag
in interface Flagged
public java.lang.Character getShortFlagCharacter()
getShortFlagCharacter
in interface Flagged
public Switch setLongFlag(java.lang.String longFlag)
longFlag
- the long flag for this Switch.public java.lang.String getLongFlag()
getLongFlag
in interface Flagged
public java.lang.String getSyntax()
public Switch setDefault(java.lang.String defaultValue)
defaultValue
- the default value for this parameter.setDefault(String)
public Switch setDefault(java.lang.String[] defaultValues)
defaultValues
- the default values for this parameter.setDefault(String)
Copyright © 2002-2006, Martian Software, Inc.. All Rights Reserved.
For the latest version and documentation, please visit http://www.martiansoftware.com/jsap