|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgroovy.lang.GroovyObjectSupport
org.crsh.command.GroovyCommand
org.crsh.command.BaseCommand<C,P>
C
- the consumed typeP
- the produced typepublic abstract class BaseCommand<C,P>
The base command.
Constructor Summary | |
---|---|
protected |
BaseCommand()
|
Method Summary | |
---|---|
Map<String,String> |
complete(CommandContext context,
String line)
Provide completions for the specified arguments. |
CommandInvoker<?,?> |
createInvoker(String line)
Provides an invoker for the specified arguments. |
String |
describe(String line,
DescriptionMode mode)
Returns a description of the command or null if none can be found. |
protected abstract void |
execute(InvocationContext<C,P> context)
|
Class<C> |
getConsumedType()
Returns the class of the consumed type. |
protected InvocationContext<?,?> |
getContext()
|
Class<P> |
getProducedType()
Returns the class of the produced type. |
boolean |
getUnquoteArguments()
Returns true if the command wants its arguments to be unquoted. |
void |
invoke(InvocationContext<C,P> context)
|
protected String |
readLine(String msg)
|
protected String |
readLine(String msg,
boolean echo)
|
void |
setUnquoteArguments(boolean unquoteArguments)
|
Methods inherited from class org.crsh.command.GroovyCommand |
---|
getProperty, invokeMethod, setProperty |
Methods inherited from class groovy.lang.GroovyObjectSupport |
---|
getMetaClass, setMetaClass |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected BaseCommand()
Method Detail |
---|
public Class<P> getProducedType()
CommandInvoker
getProducedType
in interface CommandInvoker<C,P>
public Class<C> getConsumedType()
CommandInvoker
getConsumedType
in interface CommandInvoker<C,P>
public final boolean getUnquoteArguments()
public final void setUnquoteArguments(boolean unquoteArguments)
protected final String readLine(String msg)
protected final String readLine(String msg, boolean echo)
protected final InvocationContext<?,?> getContext()
getContext
in class GroovyCommand
public final Map<String,String> complete(CommandContext context, String line)
ShellCommand
complete
in interface ShellCommand
context
- the command contextline
- the original command line arguments
public String describe(String line, DescriptionMode mode)
ShellCommand
describe
in interface ShellCommand
line
- the usage linemode
- the description mode
public final CommandInvoker<?,?> createInvoker(String line)
ShellCommand
createInvoker
in interface ShellCommand
line
- the command line arguments
public final void invoke(InvocationContext<C,P> context) throws ScriptException
invoke
in interface CommandInvoker<C,P>
context
- the command execution context
ScriptException
- any script exceptionprotected abstract void execute(InvocationContext<C,P> context) throws ScriptException
ScriptException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |