visad.install
Class TestDownload
- java.lang.Object
-
- visad.install.Download
-
- visad.install.TestDownload
-
- All Implemented Interfaces:
- CmdlineConsumer
public class TestDownload extends Download implements CmdlineConsumer
-
-
Constructor Summary
Constructors Constructor and Description TestDownload(java.lang.String[] args)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description intcheckKeyword(java.lang.String mainName, int thisArg, java.lang.String[] args)Handle subclass-specific command line options and their arguments.intcheckOption(java.lang.String mainName, char ch, java.lang.String arg)Handle subclass-specific command line options and their arguments.
If -abc -d efg -h -1 -i is specified, this method will be called a maximum of 5 times: checkOption(mainName, 'a', "bc"); checkOption(mainName, 'd', "efg"); checkOption(mainName, 'h', "-1"); checkOption(mainName, '1', "-i"); checkOption(mainName, 'i', null);
Note that either of the last two method calls may not happen if the preceeding method call claims to have used the following argument (by returning 2.
For example, if the third call (where ch is set to 'h') returns 0 or 1, the next call will contain '1' and "-i".booleanfinalizeArgs(java.lang.String mainName)Validate arguments after argument parsing has finished.
This is useful for verifying that all required keywords and options have been specified, that options don't conflict with one another, etc.voidinitializeArgs()Method used to initialize any instance variables which may be changed by a cmdline option.
This is needed when arguments are processed inside the constructor.java.lang.StringkeywordUsage()A short string included in the usage message to indicate valid keywords.
An example might be "[username] [password]".static voidmain(java.lang.String[] args)java.lang.StringoptionUsage()A short string included in the usage message to indicate valid options.
-
-
-
Method Detail
-
checkKeyword
public int checkKeyword(java.lang.String mainName, int thisArg, java.lang.String[] args)Description copied from interface:CmdlineConsumerHandle subclass-specific command line options and their arguments.- Specified by:
checkKeywordin interfaceCmdlineConsumer- Parameters:
mainName- The name of the main class (useful for error messages.)thisArg- The index of the current keyword.args- The full list of arguments.- Returns:
- less than 0 to indicate an error
0 to indicate that this argument is not used by this class
1 or more to indicate the number of arguments used
-
checkOption
public int checkOption(java.lang.String mainName, char ch, java.lang.String arg)Description copied from interface:CmdlineConsumerHandle subclass-specific command line options and their arguments.
If -abc -d efg -h -1 -i is specified, this method will be called a maximum of 5 times:- checkOption(mainName, 'a', "bc");
- checkOption(mainName, 'd', "efg");
- checkOption(mainName, 'h', "-1");
- checkOption(mainName, '1', "-i");
- checkOption(mainName, 'i', null);
Note that either of the last two method calls may not happen if the preceeding method call claims to have used the following argument (by returning 2.
For example, if the third call (where ch is set to 'h') returns 0 or 1, the next call will contain '1' and "-i". If, however, the third call returns 2, the next call will contain 'i' and null.- Specified by:
checkOptionin interfaceCmdlineConsumer- Parameters:
mainName- The name of the main class (useful for error messages.)ch- Option character. If -a is specified on the command line, 'a' would be passed to this method.)arg- The argument associated with this option.- Returns:
- less than 0 to indicate an error
0 to indicate that this option is not used by this class
1 to indicate that only the option was used
2 or greater to indicate that both the option and the argument were used
-
keywordUsage
public java.lang.String keywordUsage()
Description copied from interface:CmdlineConsumerA short string included in the usage message to indicate valid keywords.
An example might be "[username] [password]".- Specified by:
keywordUsagein interfaceCmdlineConsumer- Returns:
- A very terse description string.
-
optionUsage
public java.lang.String optionUsage()
Description copied from interface:CmdlineConsumerA short string included in the usage message to indicate valid options. An example might be "[-t type]".- Specified by:
optionUsagein interfaceCmdlineConsumer- Returns:
- A very terse description string.
-
finalizeArgs
public boolean finalizeArgs(java.lang.String mainName)
Description copied from interface:CmdlineConsumerValidate arguments after argument parsing has finished.
This is useful for verifying that all required keywords and options have been specified, that options don't conflict with one another, etc.- Specified by:
finalizeArgsin interfaceCmdlineConsumer- Parameters:
mainName- The name of the main class (useful for error messages.)- Returns:
- true if everything is correct, false if there is a problem.
-
initializeArgs
public void initializeArgs()
Description copied from interface:CmdlineConsumerMethod used to initialize any instance variables which may be changed by a cmdline option.
This is needed when arguments are processed inside the constructor. If the first line in the constructor in a class which extends this class is super(args),CmdlineParserwill be run before any instance variables for the extending class are initialized.
To ensure all instance variables are properly initialized, place the initialization code in the initializeArgs() method.- Specified by:
initializeArgsin interfaceCmdlineConsumer
-
main
public static final void main(java.lang.String[] args)
-
-
DMelt 3.0 © DataMelt by jWork.ORG