|
TUM CCSM Commons | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.tum.cs.commons.options.CmdLine
@Deprecated public class CmdLine
A very simple class for parsing command line parameters.
A typical command line looks like this:
-dir src -count occurrences TEST -dde
In this example the minus symbol ('-') is the parameter prefix ,
dir
,count
and dde
are
parameters . Whereas dir
has a single value
src
and count
has the two value
occurrences
and TEST
.
Typical method calls would have the following results.
method call | result |
---|---|
hasParameter("dde") |
true |
hasParameterAndValue("dde") |
false |
hasParameter("TEST") |
false |
getValue("src") |
"dir" |
getValue("count") |
"occurrences" |
getValues("count") |
["occurrences", "TEST"] |
Constructor Summary | |
---|---|
CmdLine(java.lang.String[] params)
Deprecated. Create new CmdLine -object from command line arguments. |
|
CmdLine(java.lang.String[] params,
java.lang.String parameterPrefix)
Deprecated. Create new CmdLine -object from command line arguments. |
Method Summary | |
---|---|
int |
getParameterCount()
Deprecated. Get number of parameters. |
java.lang.String |
getValue(java.lang.String parameterName)
Deprecated. Get the value for a parameter. |
java.lang.String[] |
getValues(java.lang.String parameterName)
Deprecated. Get the values for a parameter. |
boolean |
hasParameter(java.lang.String parameterName)
Deprecated. Checks if this command line has a certain parameter. |
boolean |
hasParameterAndValue(java.lang.String parameterName)
Deprecated. Checks if this command line has a certain parameter with at least one value. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CmdLine(java.lang.String[] params)
CmdLine
-object from command line arguments.
Parameter prefix is "-".
params
- command line arguments as provided in main()
-method.public CmdLine(java.lang.String[] params, java.lang.String parameterPrefix)
CmdLine
-object from command line arguments.
params
- command line arguments as provided in main()
-method.parameterPrefix
- parameter prefixMethod Detail |
---|
public int getParameterCount()
public java.lang.String[] getValues(java.lang.String parameterName)
parameterName
- name of the parameter.
null
is
returned.public java.lang.String getValue(java.lang.String parameterName)
parameterName
- name of the parameter.
null
is returned.public boolean hasParameter(java.lang.String parameterName)
parameterName
- name of the parameter
true
if parameter is present, false
otherwise.public boolean hasParameterAndValue(java.lang.String parameterName)
parameterName
- name of the parameter
true
if parameter and value is present,
false
otherwise.
|
TUM CCSM Commons | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |