@Deprecated public abstract class Parser extends Object implements CommandLineParser
Parser
creates CommandLine
s.Modifier and Type | Field and Description |
---|---|
protected CommandLine |
cmd
Deprecated.
commandline instance
|
Constructor and Description |
---|
Parser()
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
protected void |
checkRequiredOptions()
Deprecated.
Throws a
MissingOptionException if all of the required options
are not present. |
protected abstract String[] |
flatten(Options opts,
String[] arguments,
boolean stopAtNonOption)
Deprecated.
Subclasses must implement this method to reduce
the
arguments that have been passed to the parse method. |
protected Options |
getOptions()
Deprecated.
|
protected List |
getRequiredOptions()
Deprecated.
|
CommandLine |
parse(Options options,
String[] arguments)
Deprecated.
Parses the specified
arguments based
on the specified Options . |
CommandLine |
parse(Options options,
String[] arguments,
boolean stopAtNonOption)
Deprecated.
Parses the specified
arguments
based on the specified Options . |
CommandLine |
parse(Options options,
String[] arguments,
Properties properties)
Deprecated.
Parse the arguments according to the specified options and properties.
|
CommandLine |
parse(Options options,
String[] arguments,
Properties properties,
boolean stopAtNonOption)
Deprecated.
Parse the arguments according to the specified options and
properties.
|
void |
processArgs(Option opt,
ListIterator<String> iter)
Deprecated.
Process the argument values for the specified Option
opt using the values retrieved from the
specified iterator iter . |
protected void |
processOption(String arg,
ListIterator<String> iter)
Deprecated.
Process the Option specified by
arg using the values
retrieved from the specified iterator iter . |
protected void |
processProperties(Properties properties)
Deprecated.
Sets the values of Options using the values in
properties . |
protected void |
setOptions(Options options)
Deprecated.
|
protected CommandLine cmd
protected void setOptions(Options options)
protected Options getOptions()
protected List getRequiredOptions()
protected abstract String[] flatten(Options opts, String[] arguments, boolean stopAtNonOption) throws ParseException
arguments
that have been passed to the parse method.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 encounteredParseException
- if there are any problems encountered
while parsing the command line tokens.public CommandLine parse(Options options, String[] arguments) throws ParseException
arguments
based
on the specified Options
.parse
in interface CommandLineParser
options
- the Options
arguments
- the arguments
CommandLine
ParseException
- if there are any problems encountered
while parsing the command line tokens.public CommandLine parse(Options options, String[] arguments, Properties properties) throws ParseException
options
- the specified Optionsarguments
- the command line argumentsproperties
- command line option name-value pairsParseException
- if there are any problems encountered
while parsing the command line tokens.public CommandLine parse(Options options, String[] arguments, boolean stopAtNonOption) throws ParseException
arguments
based on the specified Options
.parse
in interface CommandLineParser
options
- the Options
arguments
- the arguments
stopAtNonOption
- if true an unrecognized argument stops
the parsing and the remaining arguments are added to the
CommandLine
s args list. If false an unrecognized
argument triggers a ParseException.CommandLine
ParseException
- if an error occurs when parsing the arguments.public CommandLine parse(Options options, String[] arguments, Properties properties, boolean stopAtNonOption) throws ParseException
options
- the specified Optionsarguments
- the command line argumentsproperties
- command line option name-value pairsstopAtNonOption
- if true an unrecognized argument stops
the parsing and the remaining arguments are added to the
CommandLine
s args list. If false an unrecognized
argument triggers a ParseException.ParseException
- if there are any problems encountered
while parsing the command line tokens.protected void processProperties(Properties properties) throws ParseException
properties
.properties
- The value properties to be processed.ParseException
- if there are any problems encountered
while processing the properties.protected void checkRequiredOptions() throws MissingOptionException
MissingOptionException
if all of the required options
are not present.MissingOptionException
- if any of the required Options are not present.public void processArgs(Option opt, ListIterator<String> iter) throws ParseException
opt
using the values retrieved from the
specified iterator iter
.opt
- The current Optioniter
- The iterator over the flattened command line Options.ParseException
- if an argument value is required
and it is has not been found.protected void processOption(String arg, ListIterator<String> iter) throws ParseException
arg
using the values
retrieved from the specified iterator iter
.arg
- The String value representing an Optioniter
- The iterator over the flattened command line arguments.ParseException
- if arg
does not represent an OptionCopyright © 2002–2017 The Apache Software Foundation. All rights reserved.