Package org.jitsi.cmd
Class CmdLine
-
- All Implemented Interfaces:
public class CmdLineUtility class for parsing command line arguments that take some value. Arguments can have one of the following formats:
- "arg=value"
- "-arg=value"
- "--arg=value"
Pawel Domas
-
-
Constructor Summary
Constructors Constructor Description CmdLine()
-
Method Summary
Modifier and Type Method Description voidaddRequiredArgument(String reqArg)Adds argument name to the list of required arguments. voidremoveRequiredArgument(String reqArg)Removes given argument name from the list of required arguments. List<String>getRequiredArguments()Returns the list of required arguments. voidparse(Array<String> args)Parses the array of command line arguments. StringgetOptionValue(String opt)Returns the value of cmd line argument for given name. StringgetOptionValue(String opt, String defaultValue)Returns the value of cmd line argument for given name. intgetIntOptionValue(String opt, int defaultValue)Returns int value of cmd line argument for given name. -
-
Method Detail
-
addRequiredArgument
void addRequiredArgument(String reqArg)
Adds argument name to the list of required arguments.
- Parameters:
reqArg- "arg", "-arg" or "--arg" argument name to be added.
-
removeRequiredArgument
void removeRequiredArgument(String reqArg)
Removes given argument name from the list of required arguments.
- Parameters:
reqArg- "arg", "-arg" or "--arg" argument name.
-
getRequiredArguments
List<String> getRequiredArguments()
Returns the list of required arguments. Names are stripped from hyphens.
-
parse
void parse(Array<String> args)
Parses the array of command line arguments.
- Parameters:
args- String array which should come from the "main" method.
-
getOptionValue
String getOptionValue(String opt)
Returns the value of cmd line argument for given name. null if there was no value or it was empty.
- Parameters:
opt- the name of command line argument which value we want to get.
-
getOptionValue
String getOptionValue(String opt, String defaultValue)
Returns the value of cmd line argument for given name. defaultValue if there was no value or it was empty.
- Parameters:
opt- the name of command line argument which value we want to get.defaultValue- the default value which should be returned if the argument value is missing.
-
getIntOptionValue
int getIntOptionValue(String opt, int defaultValue)
Returns int value of cmd line argument for given name. defaultValue if there was no valid value for that argument.
- Parameters:
opt- the name of command line argument which value we want to get.defaultValue- the default value which should be returned if the argument value is missing.
-
-
-
-