|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.exolab.jms.util.CommandLine
This core class is responsible for processing the command line and storing away the list of options and parameters specified. The difference between an option and a command line is that an option is a boolean value (true if it is specified and false otherwise) and a parameter always has an associated value.
Constructor Summary | |
CommandLine()
Default constructor which simply initialised the class |
|
CommandLine(java.lang.String[] args)
Construct an instance of this class with the specified string array. |
Method Summary | |
boolean |
add(java.lang.String name,
java.lang.String value)
Add the following option or parameter to the list. |
boolean |
add(java.lang.String name,
java.lang.String value,
boolean overwrite)
Add the following option or parameter to the list. |
boolean |
exists(java.lang.String name)
Check if the following option or command has been specified |
boolean |
isParameter(java.lang.String name)
Check if the following parameter has been specified. |
boolean |
isSwitch(java.lang.String name)
Check if the following option has been specified. |
java.lang.String |
value(java.lang.String name)
Return the value of the parameter or option. |
java.lang.String |
value(java.lang.String name,
java.lang.String defaultValue)
Return the value of the parameter or option, returning a default value if none is specified |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public CommandLine(java.lang.String[] args)
args
- command line argumentpublic CommandLine()
Method Detail |
public boolean exists(java.lang.String name)
name
- name of option or commandpublic boolean isSwitch(java.lang.String name)
name
- name of the optionpublic boolean isParameter(java.lang.String name)
name
- name of the parameterpublic java.lang.String value(java.lang.String name)
name
- name of option or parameterpublic java.lang.String value(java.lang.String name, java.lang.String defaultValue)
name
- name of option or parameterdefaultValue
- the default valuepublic boolean add(java.lang.String name, java.lang.String value)
This will automatically overwrite the previous value, if one has been specified.
name
- name of option or parametervalue
- value of namepublic boolean add(java.lang.String name, java.lang.String value, boolean overwrite)
If the overwrite flag is true then this value will overwrite the previous value. If the overwrite flag is false and the name already exists then it will not overwrite it and the function will return false. In all other circumstances it will return true.
name
- name of option or parametervalue
- value of nameoverwrite
- true to overwrite previous value
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |