visad.util
Class CmdlineParser
- java.lang.Object
-
- visad.util.CmdlineParser
-
public class CmdlineParser extends java.lang.ObjectParse command-line arguments passed to the initial main() method of an application.
To use this, a class would implement CmdlineConsumer, then add the following code snippet to the constructor (assuming the constructor is supplied a list of arguments named 'args'):
CmdlineParser cmdline = new CmdlineParser(this); if (!cmdline.processArgs(args)) {complain about errors, exit, etc.}
-
-
Constructor Summary
Constructors Constructor and Description CmdlineParser(java.lang.Object mainClass)Create a command-line parser.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidaddConsumer(CmdlineConsumer consumer)Add a command-line argument/keyword consumer.java.lang.StringgetMainClassName()Get the name of the main class.booleanprocessArgs(java.lang.String[] args)Pass all options/keywords on to allCmdlineConsumers.
-
-
-
Constructor Detail
-
CmdlineParser
public CmdlineParser(java.lang.Object mainClass)
Create a command-line parser.- Parameters:
mainClass- The class in which the main() method lives.
-
-
Method Detail
-
addConsumer
public void addConsumer(CmdlineConsumer consumer)
Add a command-line argument/keyword consumer. consumer Class which implements CmdlineConsumer.
-
getMainClassName
public java.lang.String getMainClassName()
Get the name of the main class.- Returns:
- main class name
-
processArgs
public boolean processArgs(java.lang.String[] args)
Pass all options/keywords on to allCmdlineConsumers.- Parameters:
args- Array of command-line arguments passed to main() method.
-
-
DMelt 3.0 © DataMelt by jWork.ORG