|
![]() |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.openexchange.admin.console.CLIParser
public class CLIParser
CLIParser
- The command-line parser.
Constructor Summary | |
---|---|
CLIParser()
Initializes a new non-strict CLIParser . |
|
CLIParser(boolean posix)
Initializes a new CLIParser . |
Method Summary | |
---|---|
CLIOption |
addBooleanOption(char shortForm,
java.lang.String longForm)
Convenience method for adding a boolean option. |
CLIOption |
addBooleanOption(java.lang.String longForm)
Convenience method for adding a boolean option. |
CLIOption |
addDoubleOption(char shortForm,
java.lang.String longForm)
Convenience method for adding a double option. |
CLIOption |
addDoubleOption(java.lang.String longForm)
Convenience method for adding a double option. |
CLIOption |
addIntegerOption(char shortForm,
java.lang.String longForm)
Convenience method for adding an integer option. |
CLIOption |
addIntegerOption(java.lang.String longForm)
Convenience method for adding an integer option. |
CLIOption |
addLongOption(char shortForm,
java.lang.String longForm)
Convenience method for adding a long integer option. |
CLIOption |
addLongOption(java.lang.String longForm)
Convenience method for adding a long integer option. |
CLIOption |
addOption(CLIOption opt)
Adds the specified option to the list of options. |
CLIOption |
addSettableBooleanOption(java.lang.String longForm)
Convenience method for adding a settable boolean option. |
CLIOption |
addStringOption(char shortForm,
java.lang.String longForm)
Convenience method for adding a string option. |
CLIOption |
addStringOption(java.lang.String longForm)
Convenience method for adding a string option. |
java.lang.Object |
getOptionValue(CLIOption o)
Gets given option's value. |
java.lang.Object |
getOptionValue(CLIOption o,
java.lang.Object def,
boolean remove)
Gets given option's value. |
java.util.Collection<java.lang.Object> |
getOptionValues(CLIOption option)
Gets the parsed values of all occurrences of given option, or an empty collection if the option was not set. |
java.lang.String[] |
getRemainingArgs()
|
void |
parse(java.lang.String[] argv)
Parses specified command line. |
void |
parse(java.lang.String[] argv,
java.util.Locale locale)
Parses specified command line. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CLIParser()
CLIParser
.
public CLIParser(boolean posix)
CLIParser
.
posix
- true
to strictly parse command line in POSIX notation; otherwise false
Method Detail |
---|
public CLIOption addOption(CLIOption opt)
opt
- The option to add
public CLIOption addStringOption(char shortForm, java.lang.String longForm)
shortForm
- The option's short formlongForm
- The option's long form
public CLIOption addStringOption(java.lang.String longForm)
longForm
- The option's long form
public CLIOption addSettableBooleanOption(java.lang.String longForm)
longForm
- The option's long form
public CLIOption addIntegerOption(char shortForm, java.lang.String longForm)
shortForm
- The option's short formlongForm
- The option's long form
public CLIOption addIntegerOption(java.lang.String longForm)
longForm
- The option's long form
public CLIOption addLongOption(char shortForm, java.lang.String longForm)
shortForm
- The option's short formlongForm
- The option's long form
public CLIOption addLongOption(java.lang.String longForm)
longForm
- The option's long form
public CLIOption addDoubleOption(char shortForm, java.lang.String longForm)
shortForm
- The option's short formlongForm
- The option's long form
public CLIOption addDoubleOption(java.lang.String longForm)
longForm
- The option's long form
public CLIOption addBooleanOption(char shortForm, java.lang.String longForm)
shortForm
- The option's short formlongForm
- The option's long form
public CLIOption addBooleanOption(java.lang.String longForm)
longForm
- The option's long form
public java.lang.Object getOptionValue(CLIOption o)
o
- The option whose value shall be returned
null
if not presentpublic java.lang.Object getOptionValue(CLIOption o, java.lang.Object def, boolean remove)
o
- The option whose value shall be returneddef
- The default value to return if option is not presentremove
- true
to remove option's value from parser's known values; otherwise false
public final java.util.Collection<java.lang.Object> getOptionValues(CLIOption option)
option
- The option
public java.lang.String[] getRemainingArgs()
public void parse(java.lang.String[] argv) throws CLIParseException, CLIIllegalOptionValueException, CLIUnknownOptionException
argv
- The command line arguments
CLIParseException
- If parsing fails
CLIIllegalOptionValueException
- If an illegal option occurs
CLIUnknownOptionException
- If an unknown option occurspublic void parse(java.lang.String[] argv, java.util.Locale locale) throws CLIParseException, CLIIllegalOptionValueException, CLIUnknownOptionException
argv
- The command line argumentslocale
- The locale
CLIParseException
- If parsing fails
CLIIllegalOptionValueException
- If an illegal option occurs
CLIUnknownOptionException
- If an unknown option occurs
|
![]() |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |