|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object name.kevinlocke.ultragetopt.CommandLineOption
public class CommandLineOption
Class representing a command-line option.
Field Summary | |
---|---|
protected ArgumentDisposition |
argreq
The argument requirement for this option. |
protected java.lang.String |
longopt
The long option name for this option. |
protected java.lang.Character |
shortopt
The short option character for this option. |
Constructor Summary | |
---|---|
CommandLineOption(java.lang.Character shortopt,
java.lang.String longopt,
ArgumentDisposition argreq)
Construct a new command-line option. |
Method Summary | |
---|---|
boolean |
equals(java.lang.Object obj)
Test if an object is representing the same command-line option. |
ArgumentDisposition |
getArgumentRequirement()
Gets the argument requirements for this option. |
java.lang.String |
getLongOption()
Gets the long-option character for this option. |
java.lang.Character |
getShortOption()
Gets the short-option character for this option. |
int |
hashCode()
|
boolean |
optionEncountered(java.lang.String argument)
Callback mechanism for sub-classes. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final java.lang.Character shortopt
protected final java.lang.String longopt
protected final ArgumentDisposition argreq
Constructor Detail |
---|
public CommandLineOption(java.lang.Character shortopt, java.lang.String longopt, ArgumentDisposition argreq)
new CommandLineOption('h', "help", Argument.NO_ARGUMENT)
shortopt
- The short-option form for this option (or null if none)longopt
- The long-option form for this option (or null if none).
Leader characters should be omitted (for example, use "help" instead of
"--help")argreq
- The argument requirements of this option
java.lang.IllegalArgumentException
- if shortopt and longopt are both null
(which would not represent any command-line option)Method Detail |
---|
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- the object to compare to this
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String getLongOption()
public java.lang.Character getShortOption()
public ArgumentDisposition getArgumentRequirement()
public boolean optionEncountered(java.lang.String argument) throws InvalidOptionException
argument
- The argument to this option, or null if none
InvalidOptionException
- if the option (or its argument) is
invalid in such a way that having the UltraGetopt constructor return
would be meaningless (only thrown by user-implemented functions)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |