public class CommandLineArgument extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static CommandLineArgument |
add(java.lang.String flag,
int numArgs,
java.lang.String description,
java.lang.Object... defaultStr)
Add a new CommandLineArgument for a flag with following values.
|
static CommandLineArgument |
add(java.lang.String flag,
java.lang.String description)
Add a new CommandLineArgument for a flag with a description.
|
static CommandLineArgument |
get(java.lang.String flag)
Get the CommandLineArgument for a specific flag.
|
java.lang.String |
getActionClass()
Get the action class.
|
java.lang.String |
getActionMethod()
Get the action method.
|
static java.util.Collection<CommandLineArgument> |
getAll()
Get all the CommandLineArguments registered.
|
java.lang.String |
getFlag()
Get the flag.
|
java.lang.String |
getUsage()
Get a string for the command line usage.
|
java.lang.String |
getValue()
Get the value of the first argument.
|
java.lang.String |
getValue(int index)
Get the value of the argument at a specific index.
|
static java.lang.String |
getValue(java.lang.String flag)
Get the value of the first argument for a flag.
|
boolean |
isAction()
Returns true if this CommandLineArgument is an action to run Kepler.
|
int |
parseRemainingArgs(java.lang.String[] args,
int i)
Parse one or more of the remaining command line arguments.
|
void |
setAction(java.lang.String actionClass,
java.lang.String actionMethod)
Set the class and method to invoke if this argument is seen on the command line.
|
java.lang.String |
toString()
Get a string representation of the command line argument.
|
boolean |
wasParsed()
Returns true if the last call to parseRemainingArgs() succeeded.
|
static boolean |
wasParsed(java.lang.String flag)
Returns true if the last call to parseRemainingArgs() succeeded.
|
public static CommandLineArgument add(java.lang.String flag, java.lang.String description)
public static CommandLineArgument add(java.lang.String flag, int numArgs, java.lang.String description, java.lang.Object... defaultStr)
public static CommandLineArgument get(java.lang.String flag)
public static java.util.Collection<CommandLineArgument> getAll()
public java.lang.String getFlag()
public java.lang.String getActionClass()
public java.lang.String getActionMethod()
public java.lang.String getUsage()
public java.lang.String getValue()
public java.lang.String getValue(int index)
public static java.lang.String getValue(java.lang.String flag)
public boolean isAction()
public int parseRemainingArgs(java.lang.String[] args, int i) throws java.lang.IllegalArgumentException
The
- command line arguments.The
- index to the current command line argument yet to be parsed.java.lang.IllegalArgumentException
public void setAction(java.lang.String actionClass, java.lang.String actionMethod)
public java.lang.String toString()
toString
in class java.lang.Object
public boolean wasParsed()
public static boolean wasParsed(java.lang.String flag)