|
Process UI Toolkit API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectfilenet.vw.toolkit.utils.VWCommandLineArgs
public class VWCommandLineArgs
Utility class to parse command line arguments into name/value pairs
This class provides several command line argument parsing options, including the following:
setIgnoreCase(boolean)
method.
setParamBeginChars(char[])
and setParamValueDelimiters(char[])
, respectively. Begin-parameter
separator characters may also be set with the
VWCommandLineArgs(String, boolean, char[]) constructor.
VWCommandLineArgs(String, boolean)
.
VWCommandLineArgs(String[], String[], boolean)
.
Consider inputting the following command line arguments to this class:
/x=7 /y:8 -z 9 /detail /verboseThe object created with the above arguments contains a parameter "x" with a value of 7, a parameter "y" with a value of 8, and a parameter "z" with a value of 9. The object also contains two flags: "detail" and "verbose".
Notes about command line flags:
isPresent(String)
method.
Constructor Summary | |
---|---|
VWCommandLineArgs(java.util.Properties props)
Constructor from Properties |
|
VWCommandLineArgs(java.lang.String[] argv)
Constructor for standard command-line parsing with defaults of case-sensitivity, parameter separators "/" or "-", and name-value separators of "=" or ":". |
|
VWCommandLineArgs(java.lang.String[] argv,
boolean ignoreCase)
Constructor for standard command-line parsing with default parameter separators "/" or "-" and name-value separators of "=" or ":", including a case-sensitivity control parameter |
|
VWCommandLineArgs(java.lang.String[] argv,
boolean ignoreCase,
char[] paramBeginChars)
Constructor for command-line parsing with case-sensitivity control and a character array to specify parameter separators. |
|
VWCommandLineArgs(java.lang.String[] argv,
java.lang.String[] argNames,
boolean ignoreCase)
Constructor to input one parameter that is a list containing only argv values, and another parameter that contains a list of parameter names. |
|
VWCommandLineArgs(java.lang.String fileName,
boolean ignoreCase)
Constructor to load the arguments from a "properties" file and allow case-sensitivity control. |
Method Summary | |
---|---|
int |
getIntParameter(java.lang.String paramName,
int defaultValue)
Returns the parameter value for the name specified by the input parameter and assigns an integer representation of the default value if the parameter value cannot be determined. |
java.lang.String |
getParameter(java.lang.String paramName)
Returns the parameter value for the name specified by the input parameter name. |
java.lang.String |
getParameter(java.lang.String paramName,
java.lang.String defaultValue)
Returns the parameter value for the name specified by the input parameter and assigns a string representation of the default value if the parameter value cannot be determined. |
boolean |
help()
|
boolean |
isPresent(java.lang.String flag)
Returns true if the flag is present in the command line. |
void |
list(java.io.PrintStream out)
Prints a list of properties to a printstream. |
void |
list(java.io.PrintWriter out)
Prints a list of properties to a device. |
void |
load(java.io.InputStream inStream)
Loads parameter properties from an input stream. |
static void |
main(java.lang.String[] argv)
Test method--do not use. |
java.util.Enumeration |
parameterNames()
Returns an enumeration of property names. |
void |
setIgnoreCase(boolean ignoreCase)
Controls case-sensitivity when interpreting input values. |
void |
setParamBeginChars(char[] s)
Sets the delimiters that separate parameters. |
void |
setParamValueDelimiters(char[] s)
Sets the delimiters that separate names from their values. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public VWCommandLineArgs(java.util.Properties props)
props
- public VWCommandLineArgs(java.lang.String[] argv)
argv
- command-line argument list.public VWCommandLineArgs(java.lang.String[] argv, boolean ignoreCase)
argv
- command-line argument list.ignoreCase
- boolean flag: true means no case sensitivity.public VWCommandLineArgs(java.lang.String[] argv, boolean ignoreCase, char[] paramBeginChars)
argv
- list of command-line values of parametersignoreCase
- boolean flag: true means no case sensitivity.paramBeginChars
- character array to specify parameter separatorspublic VWCommandLineArgs(java.lang.String fileName, boolean ignoreCase) throws java.lang.Exception
fileName
- name of a file containing the contents of an
argv command-line string. Note that newline counts as whitespace.ignoreCase
- boolean flag: true means no case sensitivity.
java.lang.Exception
public VWCommandLineArgs(java.lang.String[] argv, java.lang.String[] argNames, boolean ignoreCase)
With the
name-value pairs created with this constructor, a string
representation of any parameter value can be obtained in a
standardized way with the #getParameter(paramName)
method.
Note This constructor can be used to accommodate order-dependent command line parameter lists.
argv
- list of command-line values of parametersargNames
- list of parameter namesignoreCase
- boolean flag: true means no case sensitivity.Method Detail |
---|
public void setParamValueDelimiters(char[] s)
s
- a character array of name-from-value delimiterspublic void setParamBeginChars(char[] s)
s
- a character array of parameter delimiterspublic void setIgnoreCase(boolean ignoreCase)
ignoreCase
- true means case will be ignored.public java.lang.String getParameter(java.lang.String paramName)
paramName
- name of the parameter
public java.lang.String getParameter(java.lang.String paramName, java.lang.String defaultValue)
paramName
- name of the parameterdefaultValue
- the default value to assign if the
parameter value cannot be determined.
public int getIntParameter(java.lang.String paramName, int defaultValue)
paramName
- name of the parameterdefaultValue
- default value for the parameter
public boolean isPresent(java.lang.String flag)
flag
- the name of the potential flag.
public void list(java.io.PrintStream out)
out
- the stream ouputpublic void list(java.io.PrintWriter out)
out
- the print output devicepublic void load(java.io.InputStream inStream) throws java.io.IOException
inStream
- an input stream
java.io.IOException
public java.util.Enumeration parameterNames()
public static void main(java.lang.String[] argv)
argv
- a list of command-line argumentspublic boolean help()
|
Process UI Toolkit API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |