|Constructor and Description|
|Modifier and Type||Method and Description|
checkRequiredOptions, getOptions, getRequiredOptions, parse, parse, parse, parse, processArgs, processOption, processProperties, setOptions
protected String flatten(Options options, String arguments, boolean stopAtNonOption) throws ParseException
The following are the rules used by this flatten method.
stopAtNonOptionis true then do not burst anymore of
argumentsentries, just add each successive entry without further processing. Otherwise, ignore
argumentsentry is "--" just add the entry to the list of processed tokens
argumentsentry is "-" just add the entry to the list of processed tokens
argumentsentry is two characters in length and the first character is "-" then check if this is a valid
Optionid. If it is a valid id, then add the entry to the list of processed tokens and set the current
Optionmember. If it is not a valid id and
stopAtNonOptionis true, then the remaining entries are copied to the list of processed tokens. Otherwise, the current entry is ignored.
argumentsentry is more than two characters in length and the first character is "-" then we need to burst the entry to determine its constituents. For more information on the bursting algorithm see
argumentsentry is not handled by any of the previous rules, then the entry is added to the list of processed tokens.
options- The command line
arguments- The command line arguments to be parsed
stopAtNonOption- Specifies whether to stop flattening when an non option is found.
ParseException- if there are any problems encountered while parsing the command line tokens.
protected void burstToken(String token, boolean stopAtNonOption)
tokeninto its constituent parts using the following algorithm.
Optionexists with that id.
Optiondoes exist then add that character prepended with "-" to the list of processed tokens.
Optioncan have an argument value and there are remaining characters in the token then add the remaining characters as a token to the list of processed tokens.
Optiondoes NOT exist AND
stopAtNonOptionIS set then add the special token "--" followed by the remaining characters and also the remaining tokens directly to the processed tokens list.
Optiondoes NOT exist AND
stopAtNonOptionIS NOT set then add that character prepended with "-".
token- The current token to be burst
stopAtNonOption- Specifies whether to stop processing at the first non-Option encountered.
Copyright © 2002–2017 The Apache Software Foundation. All rights reserved.