|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.umd.cs.findbugs.CommandLine
public abstract class CommandLine
Helper class for parsing command line arguments.
Field Summary | |
---|---|
private java.util.Map<java.lang.String,java.lang.String> |
argumentDescriptionMap
|
(package private) int |
maxWidth
|
private java.util.Map<java.lang.String,java.lang.String> |
optionDescriptionMap
|
private java.util.Map<java.lang.String,java.lang.String> |
optionExtraPartSynopsisMap
|
private java.util.List<java.lang.String> |
optionList
|
private java.util.Set<java.lang.String> |
requiresArgumentSet
|
private static java.lang.String |
SPACES
|
Constructor Summary | |
---|---|
CommandLine()
|
Method Summary | |
---|---|
void |
addOption(java.lang.String option,
java.lang.String argumentDesc,
java.lang.String description)
Add an option requiring an argument. |
void |
addSwitch(java.lang.String option,
java.lang.String description)
Add a command line switch. |
void |
addSwitchWithOptionalExtraPart(java.lang.String option,
java.lang.String optionExtraPartSynopsis,
java.lang.String description)
Add a command line switch that allows optional extra information to be specified as part of it. |
static java.lang.String[] |
expandOptionFiles(java.lang.String[] argv,
boolean ignoreComments,
boolean ignoreBlankLines)
Expand option files in given command line. |
protected abstract void |
handleOption(java.lang.String option,
java.lang.String optionExtraPart)
Callback method for handling an option. |
protected abstract void |
handleOptionWithArgument(java.lang.String option,
java.lang.String argument)
Callback method for handling an option with an argument. |
int |
parse(java.lang.String[] argv)
Parse a command line. |
private static void |
printField(java.io.PrintStream out,
java.lang.String s,
int width)
|
void |
printUsage(java.io.OutputStream os)
Print command line usage information to given stream. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private java.util.List<java.lang.String> optionList
private java.util.Set<java.lang.String> requiresArgumentSet
private java.util.Map<java.lang.String,java.lang.String> optionDescriptionMap
private java.util.Map<java.lang.String,java.lang.String> optionExtraPartSynopsisMap
private java.util.Map<java.lang.String,java.lang.String> argumentDescriptionMap
int maxWidth
private static final java.lang.String SPACES
Constructor Detail |
---|
public CommandLine()
Method Detail |
---|
public void addSwitch(java.lang.String option, java.lang.String description)
option
- the option, must start with "-"description
- single line description of the optionpublic void addSwitchWithOptionalExtraPart(java.lang.String option, java.lang.String optionExtraPartSynopsis, java.lang.String description)
option
- the option, must start with "-"optionExtraPartSynopsis
- synopsis of the optional extra informationdescription
- single-line description of the optionpublic void addOption(java.lang.String option, java.lang.String argumentDesc, java.lang.String description)
option
- the option, must start with "-"argumentDesc
- brief (one or two word) description of the argumentdescription
- single line description of the optionpublic static java.lang.String[] expandOptionFiles(java.lang.String[] argv, boolean ignoreComments, boolean ignoreBlankLines) throws java.io.IOException
argv
- the original command lineignoreComments
- ignore comments (lines starting with "#")ignoreBlankLines
- ignore blank lines
java.io.IOException
public int parse(java.lang.String[] argv) throws java.io.IOException
argv
- the arguments
java.io.IOException
protected abstract void handleOption(java.lang.String option, java.lang.String optionExtraPart) throws java.io.IOException
option
- the optionoptionExtraPart
- the "extra" part of the option (everything after the
colon: e.g., "withMessages" in "-xml:withMessages");
the empty string if there was no extra part
java.io.IOException
protected abstract void handleOptionWithArgument(java.lang.String option, java.lang.String argument) throws java.io.IOException
option
- the optionargument
- the argument
java.io.IOException
public void printUsage(java.io.OutputStream os)
os
- the output streamprivate static void printField(java.io.PrintStream out, java.lang.String s, int width)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |