net.sourceforge.cruisecontrol.util
Class MainArgs
java.lang.Object
net.sourceforge.cruisecontrol.util.MainArgs
- public final class MainArgs
- extends java.lang.Object
Methods to perform operations on main()
arguments.
Method Summary |
static boolean |
argumentPresent(java.lang.String[] args,
java.lang.String argName)
|
static int |
findIndex(java.lang.String[] args,
java.lang.String argName)
|
static java.lang.String |
parseArgument(java.lang.String[] args,
java.lang.String argName,
java.lang.String defaultIfNoParam,
java.lang.String defaultIfNoValue)
Searches the array of args for the value corresponding to a particular
argument name. |
static int |
parseInt(java.lang.String[] args,
java.lang.String argName,
int defaultIfNoParam,
int defaultIfNoValue)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
NOT_FOUND
public static final int NOT_FOUND
- See Also:
- Constant Field Values
parseInt
public static int parseInt(java.lang.String[] args,
java.lang.String argName,
int defaultIfNoParam,
int defaultIfNoValue)
parseArgument
public static java.lang.String parseArgument(java.lang.String[] args,
java.lang.String argName,
java.lang.String defaultIfNoParam,
java.lang.String defaultIfNoValue)
- Searches the array of args for the value corresponding to a particular
argument name. This method assumes that the argName doesn't include
a "-", but adds one while looking through the array. For example, if a
user is supposed to type "-port", the appropriate argName to supply to
this method is just "port".
This method also allows the specification
of a default argument value, in case one was not specified.
- Parameters:
args
- Application arguments like those specified to the standard
Java main function.argName
- Name of the argument, without any preceeding "-",
i.e. "port" not "-port".defaultIfNoParam
- A default argument value,
in case the parameter argName was not specifieddefaultIfNoValue
- A default argument value,
in case the parameter argName was specified without a value
- Returns:
- The argument value found, or the default if none was found.
findIndex
public static int findIndex(java.lang.String[] args,
java.lang.String argName)
argumentPresent
public static boolean argumentPresent(java.lang.String[] args,
java.lang.String argName)