public class Parser extends Object
Parser interface can parse a
String array according to the Groupspecified and return a
CommandLine.| Constructor and Description |
|---|
Parser() |
| Modifier and Type | Method and Description |
|---|---|
CommandLine |
parse(String[] arguments)
Parse the arguments according to the specified options and properties.
|
CommandLine |
parseAndHelp(String[] arguments)
Parse the arguments according to the specified options and properties and
displays the usage screen if the CommandLine is not valid or the help
option was specified.
|
void |
setGroup(Group group)
Sets the Group of options to parse against
|
void |
setHelpFormatter(HelpFormatter helpFormatter)
Sets the HelpFormatter to use with the simplified parsing.
|
void |
setHelpOption(Option helpOption)
Sets the help option to use with the simplified parsing.
|
void |
setHelpTrigger(String helpTrigger)
Sets the help option to use with the simplified parsing.
|
public Parser()
public CommandLine parse(String[] arguments) throws OptionException
arguments - the command line argumentsOptionException - if there are any problems encountered while parsing the
command line tokens.public CommandLine parseAndHelp(String[] arguments)
arguments - the command line argumentspublic void setGroup(Group group)
group - the group of options to parse againstpublic void setHelpFormatter(HelpFormatter helpFormatter)
helpFormatter - the HelpFormatter to use with the simplified parsingparseAndHelp(String[])public void setHelpOption(Option helpOption)
--help, -h and -? are often used.helpOption - the help OptionparseAndHelp(String[])public void setHelpTrigger(String helpTrigger)
--help, -h and -? are often used.helpTrigger - the trigger of the help OptionparseAndHelp(String[])Copyright © 2002-2013 The Apache Software Foundation. All Rights Reserved.