Package com.kheops.util
Class ArgumentParser
java.lang.Object
com.kheops.util.ArgumentParser
Utility class that extracts parameter values from an argument array received
 in a main(String[]) method.
 
The following command line format is assumed:
java application -param1 value1 -param2 "value with spaces" -flag1
calling getArgValue("-param1", "default") would return value1 calling getArgValue("-param2", "default") would return value with spaces calling isArgPresent("-flag1") would return true.
The following command line format is assumed:
java application -param1 value1 -param2 "value with spaces" -flag1
calling getArgValue("-param1", "default") would return value1 calling getArgValue("-param2", "default") would return value with spaces calling isArgPresent("-flag1") would return true.
- 
Constructor SummaryConstructorsConstructorDescriptionArgumentParser(String args) Constructs new instance with the specified argument line.ArgumentParser(String[] args) Constructs new instance with the specified array of arguments.
- 
Method SummaryModifier and TypeMethodDescriptionString[]getArgs()getArgValue(String argName, String defaultValue) Extracts the value for the specified argument.booleanisArgPresent(String argName) Tests if an argument name is present.toString()
- 
Constructor Details- 
ArgumentParserConstructs new instance with the specified array of arguments.- Parameters:
- args- the array of arguments
 
- 
ArgumentParserConstructs new instance with the specified argument line.- Parameters:
- args- the argument line
 
 
- 
- 
Method Details- 
getArgValueExtracts the value for the specified argument. The value is the argument following the requested argument name in the argument array. If not present, specified default value is returned.- Parameters:
- argName- the arguement to extract the value for
- defaultValue- value returned if argument name not found
- Returns:
- the argument value
 
- 
isArgPresentTests if an argument name is present. Useful for testing the presence of flags that don't have values.- Parameters:
- argName- the argument name to search for
- Returns:
- true if the specified aruement name is found
 
- 
toString
- 
getArgs- Returns:
- the list of arguments managed by this parser
 
 
-