|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.enhydra.xml.xmlc.commands.options.Option
Definition of an option. The general or specific options are classes derived from this class. A general class is parameterizes at instantiation and is able to create parse multiple options. A specific class only parses one option. The Option classes should be immutable; a generic client data object is pass to the parse methods to recieve the configuration.
Field Summary | |
protected String |
help
Help message for the option. |
protected boolean |
multipleAllowed
Are multiple instances of the option allowed? |
protected String |
name
The option name, including the leading `-'. |
protected int |
numArgs
The number of arguments for the option. |
Constructor Summary | |
Option(String name,
int numArgs,
boolean multipleAllowed,
String help)
Construct a new instance of the object. |
Method Summary | |
boolean |
equals(Object obj)
Determine if two options are equal. |
String |
getHelp()
Get the help string, including option name. |
boolean |
getMultipleAllowed()
Return true if the option maybe specified multiple times, resulting in a list of values. |
String |
getName()
Get the option name, including leading `-'. |
int |
getNumArgs()
Get the number of arguments for a single instance of the option. |
int |
hashCode()
Get the hashcode for the object. |
protected abstract void |
parse(String[] args,
ErrorReporter errorReporter,
Object clientData)
Parse an instance of the option. |
Methods inherited from class java.lang.Object |
|
Field Detail |
protected final String name
protected final int numArgs
protected final boolean multipleAllowed
protected String help
Constructor Detail |
public Option(String name, int numArgs, boolean multipleAllowed, String help)
name
- Name of the option, including the leading `-'.numArgs
- Number of arguments the option takes.multipleAllowed
- Can the option be specified multiple times?help
- A string that is used in generating the help message.
It should include the arguments, a `-', then one line message. The
option name and a space will be prepended.Method Detail |
public String getName()
public int getNumArgs()
public boolean getMultipleAllowed()
public String getHelp()
public boolean equals(Object obj)
equals
in class Object
obj
- This can be either another Option object or a string. If
an Option object is supplied, the names are compared.public int hashCode()
hashCode
in class Object
protected abstract void parse(String[] args, ErrorReporter errorReporter, Object clientData) throws XMLCException
args
- The option's arguments. Will always have the number of
arguments defined for an option.errorReporter
- Used to report warnings, such as deprecated
options. Errors should be thrown.clientData
- Object that is passed to the parser. Normally
contains the object to store the configuration in.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |