|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface CommandLineSwitch
Extensions implement this interface to add new command line switches to Babel. Each command line switch has a separate instance.
Method Summary | |
---|---|
java.lang.String |
getArgumentName()
If the switch has an argument, what name should be used to identify it in the help text. |
java.lang.String |
getHelpText()
Return a brief string describing what this command line switch implies or does. |
java.lang.String |
getLongName()
Return the long option name, usually one or more words separated by hyphens. |
int |
getShortForm()
If the command line switch has a one character short form, return the character value as an integer. |
boolean |
hasOptionalArgument()
Return true if and only if, this command line switch
has an optional argument. |
boolean |
hasRequiredArgument()
Return true if and only if, this command line switch
requires an argument. |
boolean |
isHidden()
Return true if this command line option should be
hidden when the help text is generated. |
void |
processCommandSwitch(java.lang.String optarg)
This method is called when the Babel end user specifies this command line switch on the command line. |
void |
setShortForm(int value)
If the command line manager cannot support the short form you requested or if you did not specify the short form, this method will be called to set your short form. |
Method Detail |
---|
java.lang.String getLongName()
boolean hasRequiredArgument()
true
if and only if, this command line switch
requires an argument. If this method returns true
,
hasOptionalArgument should return false
.
true
implies that the switch take an optional
argument; false
implies that it does not.boolean hasOptionalArgument()
true
if and only if, this command line switch
has an optional argument. If this method returns true
,
hasRequiredArgument should return false
.
true
implies that the switch takes an optional
argument; false
implies that it does not.java.lang.String getArgumentName()
java.lang.String getHelpText()
int getShortForm()
void setShortForm(int value)
getShortForm()
is called in the future.
value
- your object must return this value in
future calls to getShortForm()
.boolean isHidden()
true
if this command line option should be
hidden when the help text is generated.
true
means that this options requests to not
be printed with the help text.void processCommandSwitch(java.lang.String optarg) throws InvalidArgumentException, InvalidOptionException, CorruptSymbolException
optarg
- this argument will be null if the command line switch
doesn't take a required argument (i.e., hasRequiredArgument()
is false
) or if the command line switch takes an
optional argument (i.e., hasOptionalArgument()
is
true
) and an argument wasn't provided; otherwise, the
argument is a non-null string including the text from the command line.
InvalidArgumentException
- this indicates
that the command line argument provided is wrong somehow. For example,
if the argument should be an integer and the input isn't a valid
integer, throw this exception.
InvalidOptionException
- this indicates
that the command line option itself is somehow wrong in the context of
preceeding switches. For example, two switches may be mutually
exclusive, so having both in a command line would cause the second
switch to throw this exception.
CorruptSymbolException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |