|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.cli2.commandline.Parser
public class Parser
A class that implements the Parser
interface can parse a
String array according to the Group
specified and return a
CommandLine
.
Field Summary | |
---|---|
private Group |
group
|
private HelpFormatter |
helpFormatter
|
private Option |
helpOption
|
private java.lang.String |
helpTrigger
|
Constructor Summary | |
---|---|
Parser()
|
Method Summary | |
---|---|
CommandLine |
parse(java.lang.String[] arguments)
Parse the arguments according to the specified options and properties. |
CommandLine |
parseAndHelp(java.lang.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(java.lang.String helpTrigger)
Sets the help option to use with the simplified parsing. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private HelpFormatter helpFormatter
private Option helpOption
private java.lang.String helpTrigger
private Group group
Constructor Detail |
---|
public Parser()
Method Detail |
---|
public CommandLine parse(java.lang.String[] arguments) throws OptionException
arguments
- the command line arguments
OptionException
- if there are any problems encountered while parsing the
command line tokens.public CommandLine parseAndHelp(java.lang.String[] arguments)
arguments
- the command line arguments
java.io.IOException
- if an error occurs while formatting helppublic 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(java.lang.String helpTrigger)
--help
, -h
and -?
are often used.
helpTrigger
- the trigger of the help OptionparseAndHelp(String[])
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |