|
3.1.1: 2012-03-29 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.basedb.clients.jobagent.CmdLine
public class CmdLine
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
| Field Summary | |
|---|---|
private String |
cmd
|
private Map<String,String> |
options
|
| Constructor Summary | |
|---|---|
CmdLine(String[] args)
Create a new object for parsing the command line. |
|
| Method Summary | |
|---|---|
String |
getCmd()
Get the command parameter |
String |
getOption(String option)
Get the value for the specified option |
String |
getOption(String option,
String defaultValue)
Get the value for an option. |
boolean |
hasOption(String option)
Check if an option was specified or not. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private final Map<String,String> options
private final String cmd
| Constructor Detail |
|---|
public CmdLine(String[] args)
args - The command line arguments sent to the main() method| Method Detail |
|---|
public String getCmd()
public String getOption(String option)
option - The option to get the value for
public String getOption(String option,
String defaultValue)
option - The option to get the value fordefaultValue - A default value if the option wasn't specified
public boolean hasOption(String option)
option - The option to check
|
3.1.1: 2012-03-29 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||