java.lang.Object
net.foxgenesis.util.ProgramArguments
Class to parse command line parameters.
Parsing code taken from https://stackoverflow.com/a/7341724
- Author:
- Ashley
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintNEED_JAVADOCvoidclear()NEED_JAVADOCintNEED_JAVADOCNEED_JAVADOCgetParameter(String key) Get the value of parameterkey.NEED_JAVADOCbooleanCheck if theprogram argumentscontains the flag "--key".booleanhasParameter(String key) Check if theprogram argumentscontains the parameter "-key".intNEED_JAVADOCvoidParse the given arguments intoflags,parametersandarguments.toString()NEED_JAVADOC
-
Constructor Details
-
ProgramArguments
public ProgramArguments()NEED_JAVADOC- See Also:
-
ProgramArguments
NEED_JAVADOC- Parameters:
args- - program arguments to parse- See Also:
-
-
Method Details
-
parse
Parse the given arguments intoflags,parametersandarguments.- Parameters:
args- - program arguments to parse
-
argumentCount
public int argumentCount()NEED_JAVADOC- Returns:
-
flagCount
public int flagCount()NEED_JAVADOC- Returns:
-
parameterCount
public int parameterCount()NEED_JAVADOC- Returns:
-
hasFlag
Check if theprogram argumentscontains the flag "--key".- Parameters:
key- - flag to check- Returns:
- returns
trueif the arguments contains the flag
-
hasParameter
Check if theprogram argumentscontains the parameter "-key".- Parameters:
key- - parameter to check- Returns:
- returns
trueif the arguments contains the parameter
-
getParameter
Get the value of parameterkey.- Parameters:
key- - The parameter key- Returns:
- Returns the
valueof parameterkey. - Throws:
NullPointerException- Thrown if parameter list does not contain thekey.- See Also:
-
getParameters
NEED_JAVADOC- Returns:
-
getArguments
NEED_JAVADOC- Returns:
-
clear
public void clear()NEED_JAVADOC -
toString
NEED_JAVADOC
-