|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectproper.io.CommandLine
public class CommandLine
This class process an array of strings and aligns the commandline parameter and its value. A parameter starts with "-" or "/" and the value is separated by a blank. The parameters are case-sensitive, i.e. "-o" and "-O" are two different parameters.
Constructor Summary | |
---|---|
CommandLine()
initializes the object |
|
CommandLine(java.lang.String[] args)
initializes the object and parses the array |
|
CommandLine(java.util.Vector args)
initializes the object and parses the string vector |
Method Summary | |
---|---|
void |
addParameterDefinition(CommandLineParameter p)
adds the given parameter to the definition list |
void |
clearParameterDefinitions()
removes all the parameter definitions |
boolean |
exists(java.lang.String parameter)
tests whether the given parameter was provided in the array |
void |
fromXML(Element node)
reads all the data stored in the children of the given node (= container) The children must be provided in an ANT compatible way, i.e. |
java.util.Vector |
getErroneous()
returns a vector with all the erroneous parameters (the names) |
java.util.Vector |
getMissing()
returns a vector with all the missing parameters (the names) |
java.util.Vector |
getParameterDefinitions()
returns all the stored definitions of parameters |
java.util.Vector |
getParameters()
returns all the parameters (not the values!) in the commandline |
java.util.Vector |
getUndefined()
returns a vector with all the undefined parameters (the names) |
java.lang.String |
getValue(java.lang.String parameter)
returns the value that is associated with the given parameter |
java.lang.String |
getValue(java.lang.String parameter,
java.lang.String defaultValue)
returns the value that is associated with the given parameter |
boolean |
hasValue(java.lang.String parameter)
tests whether the given parameter has a value |
boolean |
isComplete()
checks whether all necessary parameters were provided |
static void |
main(java.lang.String[] args)
for testing only |
void |
setArguments(java.lang.String[] args)
sets the parameters to parse |
void |
setValue(java.lang.String parameter,
java.lang.String value)
sets the value for the given parameter, e.g. |
java.lang.String[] |
toArray()
returns the parameters as an string array |
java.lang.String |
toString()
the commandline parameters in string representation |
java.util.Vector |
toVector()
returns the arguments in an vector |
Element |
toXML()
returns the content in an XML structure, where the actual data is stored in the children of the returned Element, i.e. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public CommandLine()
public CommandLine(java.util.Vector args)
public CommandLine(java.lang.String[] args)
Method Detail |
---|
public void clearParameterDefinitions()
public void addParameterDefinition(CommandLineParameter p)
p
- the parameter definition to addpublic java.util.Vector getParameterDefinitions()
public void setArguments(java.lang.String[] args)
args
- the parameters to usepublic boolean isComplete()
public boolean exists(java.lang.String parameter)
parameter
- the parameter to check for existence
public boolean hasValue(java.lang.String parameter)
parameter
- the parameter to check for its value
public java.lang.String getValue(java.lang.String parameter)
parameter
- the parameter to retrieve the value from
public java.lang.String getValue(java.lang.String parameter, java.lang.String defaultValue)
parameter
- the parameter to retrieve the value fromdefaultValue
- the default value of this parameter if it is
non existing
public void setValue(java.lang.String parameter, java.lang.String value)
parameter
- the name of the parameter to setvalue
- the value of the parameterpublic java.util.Vector getParameters()
public java.util.Vector getErroneous()
public java.util.Vector getMissing()
public java.util.Vector getUndefined()
public java.lang.String toString()
toString
in class java.lang.Object
public java.util.Vector toVector()
public java.lang.String[] toArray()
public Element toXML()
<arg value="...">
nodes
toXML
in interface XMLAccessInterface
public void fromXML(Element node)
<arg value="...">
nodes
fromXML
in interface XMLAccessInterface
node
- the Element node containing the data in its childrenpublic static void main(java.lang.String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |