Class CmdLine

java.lang.Object
net.sf.basedb.clients.jobagent.CmdLine

public class CmdLine
extends Object
Utility class for parsing command line arguments. It supports a very limitied syntax: [options] [cmd]

Options starts with hyphen (-) and may have a value following it. The last parameter is the command unless it starts with a hyphen.

Examples:

./jobagent.sh start
./jobagent.sh -c agent.properties stop
Version:
2.0
Author:
nicklas
Last modified
$Date: 2008-09-11 22:05:50 +0200 (to, 11 sep 2008) $
  • Field Details

  • Constructor Details

    • CmdLine

      public CmdLine​(String[] args)
      Create a new object for parsing the command line.
      Parameters:
      args - The command line arguments sent to the main() method
  • Method Details

    • getCmd

      public String getCmd()
      Get the command parameter
      Returns:
      The command parameter, or null
    • getOption

      public String getOption​(String option)
      Get the value for the specified option
      Parameters:
      option - The option to get the value for
      Returns:
      The value or null
    • getOption

      public String getOption​(String option, String defaultValue)
      Get the value for an option.
      Parameters:
      option - The option to get the value for
      defaultValue - A default value if the option wasn't specified
      Returns:
      The options value or the default value
    • hasOption

      public boolean hasOption​(String option)
      Check if an option was specified or not.
      Parameters:
      option - The option to check
      Returns:
      TRUE if the option was specified, FALSE otherwise