Class Parser
java.lang.Object
tripleo.vendor.org_apache_commons_cli.Parser
- All Implemented Interfaces:
CommandLineParser
- Direct Known Subclasses:
PosixParser
Deprecated.
since 1.3, the two-pass parsing with the flatten method is not enough flexible to handle complex cases
Parser creates CommandLines.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidDeprecated.Throws aMissingOptionExceptionif all of the required options are not present.protected abstract String[]Deprecated.Subclasses must implement this method to reduce theargumentsthat have been passed to the parse method.protected OptionsDeprecated.protected ListDeprecated.Deprecated.Parses the specifiedargumentsbased on the specifiedOptions.Deprecated.Parses the specifiedargumentsbased on the specifiedOptions.parse(@NotNull Options options, String[] arguments, Properties properties) Deprecated.Parse the arguments according to the specified options and properties.parse(@NotNull Options options, String @Nullable [] arguments, Properties properties, boolean stopAtNonOption) Deprecated.Parse the arguments according to the specified options and properties.voidprocessArgs(@NotNull Option opt, @NotNull ListIterator<String> iter) Deprecated.Process the argument values for the specified Optionoptusing the values retrieved from the specified iteratoriter.protected voidprocessOption(String arg, @NotNull ListIterator<String> iter) Deprecated.Process the Option specified byargusing the values retrieved from the specified iteratoriter.protected voidprocessProperties(@Nullable Properties properties) Deprecated.Sets the values of Options using the values inproperties.protected voidsetOptions(@NotNull Options options) Deprecated.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface tripleo.vendor.org_apache_commons_cli.CommandLineParser
parse
-
Field Details
-
cmd
Deprecated.CommandLine instance
-
-
Constructor Details
-
Parser
public Parser()Deprecated.
-
-
Method Details
-
checkRequiredOptions
Deprecated.Throws aMissingOptionExceptionif all of the required options are not present.- Throws:
MissingOptionException- if any of the required Options are not present.
-
flatten
protected abstract String[] flatten(Options opts, String[] arguments, boolean stopAtNonOption) throws ParseException Deprecated.Subclasses must implement this method to reduce theargumentsthat have been passed to the parse method.- Parameters:
opts- The Options to parse the arguments by.arguments- The arguments that have to be flattened.stopAtNonOption- specifies whether to stop flattening when a non option has been encountered- Returns:
- a String array of the flattened arguments
- Throws:
ParseException- if there are any problems encountered while parsing the command line tokens.
-
getOptions
Deprecated. -
setOptions
Deprecated. -
getRequiredOptions
Deprecated. -
parse
public CommandLine parse(@NotNull @NotNull Options options, String[] arguments) throws ParseException Deprecated.Parses the specifiedargumentsbased on the specifiedOptions.- Specified by:
parsein interfaceCommandLineParser- Parameters:
options- theOptionsarguments- thearguments- Returns:
- the
CommandLine - Throws:
ParseException- if there are any problems encountered while parsing the command line tokens.
-
parse
public CommandLine parse(@NotNull @NotNull Options options, String[] arguments, boolean stopAtNonOption) throws ParseException Deprecated.Parses the specifiedargumentsbased on the specifiedOptions.- Specified by:
parsein interfaceCommandLineParser- Parameters:
options- theOptionsarguments- theargumentsstopAtNonOption- iftruean unrecognized argument stops the parsing and the remaining arguments are added to theCommandLines args list. Iffalsean unrecognized argument triggers a ParseException.- Returns:
- the
CommandLine - Throws:
ParseException- if an error occurs when parsing the arguments.
-
parse
public CommandLine parse(@NotNull @NotNull Options options, String[] arguments, Properties properties) throws ParseException Deprecated.Parse the arguments according to the specified options and properties.- Parameters:
options- the specified Optionsarguments- the command line argumentsproperties- command line option name-value pairs- Returns:
- the list of atomic option and value tokens
- Throws:
ParseException- if there are any problems encountered while parsing the command line tokens.- Since:
- 1.1
-
parse
public CommandLine parse(@NotNull @NotNull Options options, String @Nullable [] arguments, Properties properties, boolean stopAtNonOption) throws ParseException Deprecated.Parse the arguments according to the specified options and properties.- Parameters:
options- the specified Optionsarguments- the command line argumentsproperties- command line option name-value pairsstopAtNonOption- iftruean unrecognized argument stops the parsing and the remaining arguments are added to theCommandLines args list. Iffalsean unrecognized argument triggers a ParseException.- Returns:
- the list of atomic option and value tokens
- Throws:
ParseException- if there are any problems encountered while parsing the command line tokens.- Since:
- 1.1
-
processArgs
public void processArgs(@NotNull @NotNull Option opt, @NotNull @NotNull ListIterator<String> iter) throws ParseException Deprecated.Process the argument values for the specified Optionoptusing the values retrieved from the specified iteratoriter.- Parameters:
opt- The current Optioniter- The iterator over the flattened command line Options.- Throws:
ParseException- if an argument value is required and it is has not been found.
-
processOption
protected void processOption(String arg, @NotNull @NotNull ListIterator<String> iter) throws ParseException Deprecated.Process the Option specified byargusing the values retrieved from the specified iteratoriter.- Parameters:
arg- The String value representing an Optioniter- The iterator over the flattened command line arguments.- Throws:
ParseException- ifargdoes not represent an Option
-
processProperties
Deprecated.Sets the values of Options using the values inproperties.- Parameters:
properties- The value properties to be processed.- Throws:
ParseException- if there are any problems encountered while processing the properties.
-