|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.sadun.util.BaseCommand
A base class for command-line based tools using CmdLineOptions
.
Field Summary | |
protected CmdLineOptions |
co
The CmdLineOptions object, initialized at construction. |
Constructor Summary | |
protected |
BaseCommand()
Create an instance with the no tool description. |
protected |
BaseCommand(java.lang.String commandDescription)
Create an instance with the given tool description. |
Method Summary | |
boolean |
isHelpRequested()
Return whether or not the user has specified the help option |
protected void |
main0(java.lang.String[] args)
Can be invoked from the subclass static main(String args[]) method to automatically handle user errors. |
protected void |
postParse()
This method is invoked by main0(String[]) after the
options are parsed, but before the command is run.
|
protected void |
preParse()
Invoked after construction, but before parsing. |
protected abstract void |
run()
This method must be overriden by subclasses to implement the command functionality. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected CmdLineOptions co
CmdLineOptions
object, initialized at construction.
Constructor Detail |
protected BaseCommand(java.lang.String commandDescription)
The co
member is created and initialized with an help option -help
with aliases h and ?.
Subclasses will add other options to the co
member.
commandDescription
- a textual description of the toolprotected BaseCommand()
The co
member is created and initialized with an help option -help
with aliases h and ?.
Subclasses will add other options to the co
member.
Method Detail |
public boolean isHelpRequested()
protected void main0(java.lang.String[] args)
A typical subclass Tool
will contain a main() method like
public static void main(String [] args) { new Tool().main0(args); }
args
- the command line argumentsprotected abstract void run()
protected void preParse()
protected void postParse()
main0(String[])
after the
options are parsed, but before the command is run.
This implementation does nothing.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |