|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.uc4.ara.collabnet.JArgs.CmdLineParser
public class CmdLineParser
Nested Class Summary | |
---|---|
static class |
CmdLineParser.IllegalOptionValueException
Thrown when an illegal or missing value is given by the user for an option that takes a value. |
static class |
CmdLineParser.NotFlagException
Thrown when the parsed commandline contains multiple concatenated short options, such as -abcd, where one or more requires a value. |
static class |
CmdLineParser.Option<T>
Representation of a command-line option |
static class |
CmdLineParser.OptionException
Base class for exceptions that may be thrown when options are parsed |
static class |
CmdLineParser.UnknownOptionException
Thrown when the parsed command-line contains an option that is not recognised. |
static class |
CmdLineParser.UnknownSuboptionException
Thrown when the parsed commandline contains multiple concatenated short options, such as -abcd, where one is unknown. |
Constructor Summary | |
---|---|
CmdLineParser()
|
Method Summary | ||
---|---|---|
CmdLineParser.Option<java.lang.Boolean> |
addBooleanOption(java.lang.String longForm,
boolean required)
Convenience method for adding a boolean option. |
|
CmdLineParser.Option<java.lang.Boolean> |
addBooleanOption(java.lang.String shortForm,
java.lang.String longForm,
boolean required)
Convenience method for adding a boolean option. |
|
CmdLineParser.Option<java.lang.Double> |
addDoubleOption(java.lang.String longForm,
boolean required)
Convenience method for adding a double option. |
|
CmdLineParser.Option<java.lang.Double> |
addDoubleOption(java.lang.String shortForm,
java.lang.String longForm,
boolean required)
Convenience method for adding a double option. |
|
|
addHelp(CmdLineParser.Option<T> option,
java.lang.String helpString)
|
|
CmdLineParser.Option<java.lang.Integer> |
addIntegerOption(java.lang.String longForm,
boolean required)
Convenience method for adding an integer option. |
|
CmdLineParser.Option<java.lang.Integer> |
addIntegerOption(java.lang.String shortForm,
java.lang.String longForm,
boolean required)
Convenience method for adding an integer option. |
|
CmdLineParser.Option<java.lang.Long> |
addLongOption(java.lang.String longForm,
boolean required)
Convenience method for adding a long integer option. |
|
CmdLineParser.Option<java.lang.Long> |
addLongOption(java.lang.String shortForm,
java.lang.String longForm,
boolean required)
Convenience method for adding a long integer option. |
|
|
addOption(CmdLineParser.Option<T> opt)
Add the specified Option to the list of accepted options |
|
CmdLineParser.Option<java.lang.String> |
addStringOption(java.lang.String longForm,
boolean required)
Convenience method for adding a string option. |
|
CmdLineParser.Option<java.lang.String> |
addStringOption(java.lang.String shortForm,
java.lang.String longForm,
boolean required)
Convenience method for adding a string option. |
|
|
getOptionValue(CmdLineParser.Option<T> o)
Equivalent to getOptionValue(o,
null) . |
|
|
getOptionValue(CmdLineParser.Option<T> o,
T def)
|
|
|
getOptionValues(CmdLineParser.Option<T> option)
|
|
java.lang.String[] |
getRemainingArgs()
|
|
void |
parse(java.lang.String[] argv)
Extract the options and non-option arguments from the given list of command-line arguments. |
|
void |
parse(java.lang.String[] argv,
java.util.Locale locale)
Extract the options and non-option arguments from the given list of command-line arguments. |
|
void |
printUsage(java.lang.String feature)
|
|
void |
setExamples(java.lang.String examples)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CmdLineParser()
Method Detail |
---|
public final <T> CmdLineParser.Option<T> addOption(CmdLineParser.Option<T> opt)
public final CmdLineParser.Option<java.lang.String> addStringOption(java.lang.String shortForm, java.lang.String longForm, boolean required)
public final CmdLineParser.Option<java.lang.String> addStringOption(java.lang.String longForm, boolean required)
public final CmdLineParser.Option<java.lang.Integer> addIntegerOption(java.lang.String shortForm, java.lang.String longForm, boolean required)
public final CmdLineParser.Option<java.lang.Integer> addIntegerOption(java.lang.String longForm, boolean required)
public final CmdLineParser.Option<java.lang.Long> addLongOption(java.lang.String shortForm, java.lang.String longForm, boolean required)
public final CmdLineParser.Option<java.lang.Long> addLongOption(java.lang.String longForm, boolean required)
public final CmdLineParser.Option<java.lang.Double> addDoubleOption(java.lang.String shortForm, java.lang.String longForm, boolean required)
public final CmdLineParser.Option<java.lang.Double> addDoubleOption(java.lang.String longForm, boolean required)
public final CmdLineParser.Option<java.lang.Boolean> addBooleanOption(java.lang.String shortForm, java.lang.String longForm, boolean required)
public final CmdLineParser.Option<java.lang.Boolean> addBooleanOption(java.lang.String longForm, boolean required)
public final <T> T getOptionValue(CmdLineParser.Option<T> o) throws java.lang.Exception
getOptionValue(o,
null)
.
CmdLineParser.OptionException
java.lang.Exception
public final <T> T getOptionValue(CmdLineParser.Option<T> o, T def) throws java.lang.Exception
CmdLineParser.OptionException
java.lang.Exception
public final <T> java.util.Collection<T> getOptionValues(CmdLineParser.Option<T> option) throws java.lang.Exception
CmdLineParser.OptionException
java.lang.Exception
public final java.lang.String[] getRemainingArgs()
public final void parse(java.lang.String[] argv) throws CmdLineParser.OptionException
CmdLineParser.OptionException
public final void parse(java.lang.String[] argv, java.util.Locale locale) throws CmdLineParser.OptionException
CmdLineParser.OptionException
public <T> CmdLineParser.Option<T> addHelp(CmdLineParser.Option<T> option, java.lang.String helpString)
public void setExamples(java.lang.String examples)
public void printUsage(java.lang.String feature)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |