Package net.sf.basedb.clients.jobagent
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 Summary
-
Constructor Summary
-
Method Summary
Modifier and Type Method Description String
getCmd()
Get the command parameterString
getOption(String option)
Get the value for the specified optionString
getOption(String option, String defaultValue)
Get the value for an option.boolean
hasOption(String option)
Check if an option was specified or not.
-
Field Details
-
options
-
cmd
-
-
Constructor Details
-
CmdLine
Create a new object for parsing the command line.- Parameters:
args
- The command line arguments sent to themain()
method
-
-
Method Details
-
getCmd
Get the command parameter- Returns:
- The command parameter, or null
-
getOption
Get the value for the specified option- Parameters:
option
- The option to get the value for- Returns:
- The value or null
-
getOption
Get the value for an option.- Parameters:
option
- The option to get the value fordefaultValue
- A default value if the option wasn't specified- Returns:
- The options value or the default value
-
hasOption
Check if an option was specified or not.- Parameters:
option
- The option to check- Returns:
- TRUE if the option was specified, FALSE otherwise
-