|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object gnu.classpath.tools.getopt.Option
public abstract class Option
This is the base class representing an option. An option can have a short form. This is a single character, like '-x'. An option can have a long form, like '--verbose'; if the parser is working in "long option only" mode, then a long flag has a single dash, like '-verbose'. Both a long and a short form may be specified; it is not valid to have neither. A description is mandatory for options; this is used to automatically generate '--help' output. An option which takes an argument and which has a short form can also be "joined", in this case the option's argument can either be separated, like "-I path" or joined with the short option name, like "-Ipath".
Field Summary | |
---|---|
private String |
argumentName
|
private String |
description
|
private boolean |
joined
|
private String |
longName
|
private char |
shortName
|
Constructor Summary | |
---|---|
protected |
Option(char shortName,
String description)
Create a new option with the given short name and description. |
protected |
Option(char shortName,
String description,
String argumentName)
Create a new option with the given short name and description. |
protected |
Option(char shortName,
String description,
String argumentName,
boolean joined)
Create a new option with the given short name and description. |
protected |
Option(String longName,
char shortName,
String description)
Create a new option with the given short and long names and description. |
protected |
Option(String longName,
char shortName,
String description,
String argumentName)
Create a new option with the given short and long names and description. |
protected |
Option(String longName,
char shortName,
String description,
String argumentName,
boolean joined)
Create a new option with the given short and long names and description. |
protected |
Option(String longName,
String description)
Create a new option with the given long name and description. |
protected |
Option(String longName,
String description,
String argumentName)
Create a new option with the given long name and description. |
Method Summary | |
---|---|
String |
getArgumentName()
Return the name of the argument. |
String |
getDescription()
Return the description of the option. |
String |
getLongName()
Return the long name of the option, or null if none. |
char |
getShortName()
Return the short name of the option, or \0 if none. |
boolean |
getTakesArgument()
Return true if the argument takes an option. |
boolean |
isJoined()
Return true if this is a "joined" option, false otherwise. |
abstract void |
parsed(String argument)
This is called by the parser when this option is recognized. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private char shortName
private String longName
private String description
private String argumentName
private boolean joined
Constructor Detail |
---|
protected Option(char shortName, String description)
shortName
- the short namedescription
- the descriptionprotected Option(char shortName, String description, String argumentName)
shortName
- the short namedescription
- the descriptionargumentName
- the descriptive name of the argument, if this option
takes an argument; otherwise nullprotected Option(char shortName, String description, String argumentName, boolean joined)
shortName
- the short namedescription
- the descriptionargumentName
- the descriptive name of the argument, if this option
takes an argument; otherwise nulljoined
- true if the short option is joined to its argumentprotected Option(String longName, String description)
longName
- the long namedescription
- the descriptionprotected Option(String longName, String description, String argumentName)
longName
- the long namedescription
- the descriptionargumentName
- the descriptive name of the argument, if this option
takes an argument; otherwise nullprotected Option(String longName, char shortName, String description)
longName
- the long nameshortName
- the short namedescription
- the descriptionprotected Option(String longName, char shortName, String description, String argumentName)
longName
- the long nameshortName
- the short namedescription
- the descriptionargumentName
- the descriptive name of the argument, if this option
takes an argument; otherwise nullprotected Option(String longName, char shortName, String description, String argumentName, boolean joined)
longName
- the long nameshortName
- the short namedescription
- the descriptionargumentName
- the descriptive name of the argument, if this option
takes an argument; otherwise nulljoined
- true if the short option is joined to its argumentMethod Detail |
---|
public char getShortName()
public String getLongName()
public boolean getTakesArgument()
public String getArgumentName()
public String getDescription()
public boolean isJoined()
public abstract void parsed(String argument) throws OptionException
argument
- the argument
OptionException
- if the option or its argument is somehow invalid
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |