public abstract class ModuleCommand extends AbstractModule implements Cancelable, Command, Contextual
Module directly (rather than using the
CommandModule adapter class). This is useful for commands which want
to inspect and manipulate their own inputs and outputs programmatically.| Constructor and Description |
|---|
ModuleCommand() |
| Modifier and Type | Method and Description |
|---|---|
void |
cancel(String reason)
Cancels the operation execution, with the given reason for doing so.
|
String |
getCancelReason()
Gets a message describing why the operation was canceled.
|
Context |
getContext()
Gets the application context to which the object belongs, or null if
Contextual.setContext(Context) has not yet been called on this object. |
CommandInfo |
getInfo()
Gets metadata about this module.
|
boolean |
isCanceled()
Gets whether the operation has been canceled.
|
void |
setContext(Context context)
Sets the application context to which the object belongs.
|
cancel, getDelegateObject, getInput, getInputs, getOutput, getOutputs, initialize, isInputResolved, isOutputResolved, preview, resolveInput, resolveOutput, setInput, setInputs, setOutput, setOutputs, unresolveInput, unresolveOutputclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcontextisResolved, setResolvedpublic CommandInfo getInfo()
Modulepublic Context getContext()
ContextualContextual.setContext(Context) has not yet been called on this object.getContext in interface ContextualContextual.context()public void setContext(Context context)
Contextual
Typically this method simply delegates to Context.inject(Object),
and should be called only once to populate the context. Most contextual
objects do not support later alteration of the context, and will throw
IllegalStateException if this method is invoked again.
setContext in interface ContextualContext.inject(Object)public boolean isCanceled()
CancelableisCanceled in interface Cancelablepublic void cancel(String reason)
Cancelable
This method merely sets the operation status to canceled; it cannot
necessarily stop the operation itself. That is, it is the responsibility of
each individual operation to check Cancelable.isCanceled() in a timely manner
during execution, and stop doing whatever it is doing if the flag has been
tripped.
cancel in interface Cancelablereason - A message describing why the operation is being canceled.public String getCancelReason()
CancelablegetCancelReason in interface CancelableCopyright © 2009–2023 SciJava. All rights reserved.