|
||||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||
java.lang.Object
|
+--org.sapia.console.Console
|
+--org.sapia.console.CommandConsole
A command-line console that can be embedded in applications. The
console parses command-lines to create Command instances
that it executes.
An instance of this class takes a CommandFactory at
construction, and delegates command object creation to it.
Embedding a command console is as shown below:
ReflectCommandFactory fac = new ReflectCommandFactory();
fac.addPackage("org.mycommand.package");
CommandConsole cons = new CommandConsole(fac);
cons.start();
| Field Summary |
|---|
| Fields inherited from class org.sapia.console.Console |
|---|
DEFAULT_PROMPT |
| Constructor Summary | |
|---|---|
CommandConsole(CommandFactory fac)
Creates an instance of this class with the given factory. |
|
CommandConsole(InputStream in,
OutputStream out,
CommandFactory fac)
Creates an instance of this class with the given factory. |
|
| Method Summary | |
|---|---|
protected Context |
newContext()
Template method internally called by this instance to create new Context instances. |
void |
setCommandListener(ConsoleListener listener)
Sets this instance's command listener. |
void |
start()
Starts this console in the current thread and loops indefinily on input/display until an AbortException is thrown by a
Command instance. |
| Methods inherited from class org.sapia.console.Console |
|---|
in, input, out, print, println, prompt, readLine, setOut, setPrompt |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public CommandConsole(CommandFactory fac)
fac - A CommandFactory.
public CommandConsole(InputStream in,
OutputStream out,
CommandFactory fac)
in - The input stream of the console.out - The output stream of the console.fac - A CommandFactory.
>>>>>>> 1.6| Method Detail |
public void setCommandListener(ConsoleListener listener)
public void start()
AbortException is thrown by a
Command instance.
protected Context newContext()
Context instances.
|
||||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||