public abstract class DynamicCommand extends DefaultMutableModule implements Cancelable, Command, Contextual
Command
interface and using only @Parameter
annotations on
instance fields.Modifier and Type | Field and Description |
---|---|
protected ModuleService |
moduleService |
protected PluginService |
pluginService |
Constructor and Description |
---|
DynamicCommand() |
Modifier and Type | Method and Description |
---|---|
void |
cancel(String reason)
Cancels the operation execution, with the given reason for doing so.
|
Context |
context()
Gets the application context to which the object belongs.
|
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. |
DynamicCommandInfo |
getInfo()
Gets metadata about this module.
|
Object |
getInput(String name)
Gets the value of the input with the given name.
|
Object |
getOutput(String name)
Gets the value of the output with the given name.
|
boolean |
isCanceled()
Gets whether the operation has been canceled.
|
protected void |
saveInputs()
Persists current input values.
|
void |
setContext(Context context)
Sets the application context to which the object belongs.
|
void |
setInput(String name,
Object value)
Sets the value of the input with the given name.
|
void |
setOutput(String name,
Object value)
Sets the value of the output with the given name.
|
void |
uncancel() |
cancel, getDelegateObject, getInputs, getOutputs, initialize, isInputResolved, isOutputResolved, preview, resolveInput, resolveOutput, setInputs, setOutputs, unresolveInput, unresolveOutput
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addInput, addInput, addOutput, addOutput, removeInput, removeOutput, run
cancel, getDelegateObject, getInputs, getOutputs, initialize, isInputResolved, isOutputResolved, isResolved, preview, resolveInput, resolveOutput, setInputs, setOutputs, setResolved, unresolveInput, unresolveOutput
protected PluginService pluginService
protected ModuleService moduleService
public DynamicCommandInfo getInfo()
Module
getInfo
in interface Module
getInfo
in interface MutableModule
getInfo
in class DefaultMutableModule
public Object getInput(String name)
Module
getInput
in interface Module
getInput
in class AbstractModule
public Object getOutput(String name)
Module
getOutput
in interface Module
getOutput
in class AbstractModule
public void setInput(String name, Object value)
Module
setInput
in interface Module
setInput
in class AbstractModule
public void setOutput(String name, Object value)
Module
setOutput
in interface Module
setOutput
in class AbstractModule
public Context context()
Contextual
context
in interface Contextual
Contextual.getContext()
public Context getContext()
Contextual
Contextual.setContext(Context)
has not yet been called on this object.getContext
in interface Contextual
Contextual.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 Contextual
Context.inject(Object)
public boolean isCanceled()
Cancelable
isCanceled
in interface Cancelable
public 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 Cancelable
reason
- A message describing why the operation is being canceled.public String getCancelReason()
Cancelable
getCancelReason
in interface Cancelable
public void uncancel()
protected void saveInputs()
InteractiveCommand
s
that want to persist values as they change, since interactive commands do
not complete the module execution lifecycle normally.Copyright © 2015–2022 SciJava. All rights reserved.