@Deprecated public class CmdLine extends java.lang.Object
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 and Description |
---|
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. |
Modifier and Type | Method and Description |
---|---|
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.
|
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 prefixpublic 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 parametertrue
if parameter is present, false
otherwise.public boolean hasParameterAndValue(java.lang.String parameterName)
parameterName
- name of the parametertrue
if parameter and value is present,
false
otherwise.