Documentation of 'visad.util.CmdlineParser' Java class
CmdlineParser
visad.util

Class CmdlineParser



  • public class CmdlineParser
    extends java.lang.Object
    Parse 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.
    • 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 all CmdlineConsumers.
        Parameters:
        args - Array of command-line arguments passed to main() method.

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.