|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ohrasys.app.AppOption
public class AppOption
An object representing a command line option.
Field Summary | |
---|---|
static int |
FLAG_TYPE
Indicates the option is a simple flag |
static int |
LIST_TYPE
Indicates the option contains a list of arguments |
static int |
OPTION_TYPE
Indicates the option contains an argument |
static int |
UNKNOWN
Indicates the option type is not known |
static int |
UNLIMITED_LENGTH
Indicates that a list option has an unconstrained argument list length |
Method Summary | |
---|---|
static AppOption |
findListOption(AppOption[] options)
Returns a list type application option if one exists in the list provided. |
static AppOption |
findOption(java.lang.String name,
AppOption[] options)
Returns an option with the given name. |
static AppOption |
getFlag(java.lang.String name)
Creates a new flag type option. |
int |
getLen()
Returns the number of data values associated with this option. |
static AppOption |
getList()
Creates a new list type option. |
java.lang.String |
getName()
Returns the name of this option. |
static AppOption |
getOption(java.lang.String name)
Returns a named option having one value. |
static AppOption |
getOption(java.lang.String name,
int numvalues)
Returns a named option having a finite number of values. |
int |
getType()
Returns the type of this option. |
java.lang.String |
getValue()
Returns the value of this option in a string representation. |
static AppOption[] |
parseCLArgs(java.lang.String[] args,
AppOption[] templates)
Parses the command line arguments of an application and compares those options against a list of expected options. |
void |
setValue(java.lang.String value)
Sets the value of this option. |
java.lang.String |
toString()
Returns a string representation of the values associated with this option. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int FLAG_TYPE
public static final int OPTION_TYPE
public static final int LIST_TYPE
public static final int UNKNOWN
public static final int UNLIMITED_LENGTH
Method Detail |
---|
public static AppOption findListOption(AppOption[] options)
options
- The options to search through.
public static AppOption findOption(java.lang.String name, AppOption[] options)
name
- The option name to search foroptions
- The list of options to search through
public static AppOption getFlag(java.lang.String name)
name
- The name of the option
public static AppOption getList()
public static AppOption getOption(java.lang.String name)
program -log <logfile>
In this case the -log option has a length of one value of <logfile>.
name
- The name of the option.
public static AppOption getOption(java.lang.String name, int numvalues)
diff -files <file1> <file2>
In this case the -files option has a length of two values of <file1> and <file2>
name
- The name of the optionnumvalues
- The number of values associated with the option.
public static AppOption[] parseCLArgs(java.lang.String[] args, AppOption[] templates) throws AppException
args
- The command line arguments to parsetemplates
- The template list of application options.
AppException
- If an error in processing occurs.public int getLen()
public java.lang.String getName()
public int getType()
public java.lang.String getValue()
public void setValue(java.lang.String value)
value
- The new value of the option.public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |