public class CommandInfo extends PluginInfo<Command> implements ModuleInfo
Command.
Unlike its more general superclass PluginInfo, a CommandInfo
implements ModuleInfo, allowing it to describe and instantiate the
command in Module form.
- The interface which provides many methods for interrogating
structural details of a {@link Module}.,
- An adapter class that bridges the gap between
{@link Command}s and the rich {@link Module} interface.APPLICATION_MENU_ROOT| Modifier | Constructor and Description |
|---|---|
|
CommandInfo(Class<? extends Command> commandClass)
Creates a new command metadata object.
|
|
CommandInfo(Class<? extends Command> commandClass,
Plugin annotation)
Creates a new command metadata object.
|
|
CommandInfo(PluginInfo<Command> info)
Creates a new command metadata object describing the same command as the
given
PluginInfo. |
protected |
CommandInfo(PluginInfo<Command> info,
String className,
Class<? extends Command> commandClass,
Plugin annotation) |
|
CommandInfo(String className)
Creates a new command metadata object.
|
|
CommandInfo(String className,
Plugin annotation)
Creates a new command metadata object.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
canCancel()
Gets whether the module condones cancellation.
|
boolean |
canPreview()
Gets whether the module supports previews.
|
boolean |
canRunHeadless()
Gets whether the module condones headless execution.
|
Command |
createInstance()
Creates an object.
|
Module |
createModule()
Instantiates the module described by this module info.
|
Module |
createModule(Command commandInstance)
Instantiates the module described by this module info, around the specified
existing command instance.
|
String |
getClassName()
Gets the fully qualified name of the
Class of the objects that can
be created. |
String |
getDelegateClassName()
Gets the fully qualified name of the class containing the module's actual
implementation.
|
URL |
getIconURL()
Gets the URL corresponding to the icon resource path.
|
String |
getIdentifier()
Gets a string intended to function as an identifier for the object.
|
String |
getInitializer()
Gets the function that is called to initialize the module's values.
|
CommandModuleItem<?> |
getInput(String name)
Gets the input item with the given name.
|
<T> CommandModuleItem<T> |
getInput(String name,
Class<T> type)
Gets the input item with the given name and type.
|
CommandModuleItem<?> |
getOutput(String name)
Gets the output item with the given name.
|
<T> CommandModuleItem<T> |
getOutput(String name,
Class<T> type)
Gets the output item with the given name and type.
|
Class<? extends Command> |
getPluginClass()
Obtains the
Class of the item objects, if that class has already
been loaded. |
Map<String,Object> |
getPresets()
Gets the table of items with fixed, preset values.
|
List<ValidityProblem> |
getProblems()
Gets the list of problems encountered while initializing the object.
|
String |
getTitle()
Gets an appropriate title for the object, for use in a user interface.
|
Iterable<ModuleItem<?>> |
inputs()
Gets the list of input items.
|
boolean |
isInteractive()
Gets whether the module is intended to be run interactively.
|
boolean |
isValid()
Gets whether the object is completely valid (i.e., no problems during
initialization).
|
Class<? extends Command> |
loadClass()
Loads the class corresponding to the objects that are created by
Instantiable.createInstance(). |
Class<?> |
loadDelegateClass()
Loads the class containing the module's actual implementation.
|
Iterable<ModuleItem<?>> |
outputs()
Gets the list of output items.
|
void |
setPluginClass(Class<? extends Command> pluginClass)
Explicitly sets the
Class of the item objects. |
void |
setPresets(Map<String,Object> presets)
Sets the table of items with fixed, preset values.
|
String |
toString() |
void |
update(EventService eventService)
Notifies interested parties that the module info has been modified.
|
create, create, get, get, get, getAnnotation, getLocation, getOrCreate, getOrCreate, getPluginType, getVersion, inject, setPluginTypegetIconPath, getMenuPath, getMenuRoot, getPriority, getSelectionGroup, isEnabled, isSelectable, isSelected, isVisible, setEnabled, setIconPath, setMenuPath, setMenuRoot, setPriority, setSelectable, setSelected, setSelectionGroup, setVisibleget, getDescription, getLabel, getName, is, set, setDescription, setLabel, setNameclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetLocation, getVersioncompareTo, getIconPath, getMenuPath, getMenuRoot, getSelectionGroup, isEnabled, isSelectable, isSelected, isVisible, setEnabled, setIconPath, setMenuPath, setMenuRoot, setSelectable, setSelected, setSelectionGroup, setVisibleget, getDescription, getLabel, is, set, setDescription, setLabelgetPriority, setPrioritypublic CommandInfo(String className)
className - The name of the class, which must implement
Command.public CommandInfo(String className, Plugin annotation)
public CommandInfo(Class<? extends Command> commandClass)
commandClass - The plugin class, which must implement Command.public CommandInfo(Class<? extends Command> commandClass, Plugin annotation)
public CommandInfo(PluginInfo<Command> info)
PluginInfo.info - The plugin metadata to wrap.public void setPresets(Map<String,Object> presets)
public Map<String,Object> getPresets()
public Module createModule(Command commandInstance)
public void setPluginClass(Class<? extends Command> pluginClass)
PluginInfoClass of the item objects.
This is useful if your class is produced by something other than the system classloader.
setPluginClass in class PluginInfo<Command>public Class<? extends Command> getPluginClass()
PluginInfoClass of the item objects, if that class has already
been loaded.getPluginClass in class PluginInfo<Command>Class, or null if it has not yet been loaded by
PluginInfo.loadClass().public URL getIconURL() throws InstantiableException
PluginInfogetIconURL in class PluginInfo<Command>InstantiableExceptionAbstractUIDetails.getIconPath()public String toString()
toString in class PluginInfo<Command>public String getClassName()
InstantiableClass of the objects that can
be created.getClassName in interface Instantiable<Command>getClassName in class PluginInfo<Command>public Class<? extends Command> loadClass() throws InstantiableException
InstantiableInstantiable.createInstance().
Note that this class may not be precisely T.class but instead a
subclass thereof.
loadClass in interface Instantiable<Command>loadClass in class PluginInfo<Command>InstantiableExceptionfor an example of an
{@code Instantiable} type that typically instantiates objects of a
subtype of {@code T} rather than {@code T} itself.public Command createInstance() throws InstantiableException
InstantiablecreateInstance in interface Instantiable<Command>createInstance in class PluginInfo<Command>InstantiableExceptionpublic CommandModuleItem<?> getInput(String name)
ModuleInfogetInput in interface ModuleInfopublic <T> CommandModuleItem<T> getInput(String name, Class<T> type)
ModuleInfogetInput in interface ModuleInfopublic CommandModuleItem<?> getOutput(String name)
ModuleInfogetOutput in interface ModuleInfopublic <T> CommandModuleItem<T> getOutput(String name, Class<T> type)
ModuleInfogetOutput in interface ModuleInfopublic Iterable<ModuleItem<?>> inputs()
ModuleInfoinputs in interface ModuleInfopublic Iterable<ModuleItem<?>> outputs()
ModuleInfooutputs in interface ModuleInfopublic String getDelegateClassName()
ModuleInfocreateModule().getDelegateObject().getClass().getName(), and hence
is also the class containing any callback methods specified by
ModuleItem.getCallback().
The nature of this method is implementation-specific; for example, a
CommandModule will return the class name of its associated
Command. For modules that are not commands, the result may be
something else.
If you are implementing this interface directly, a good rule of thumb is to
return the class name of the associated Module (i.e., the same
value given by createModule().getClass().getName()).
getDelegateClassName in interface ModuleInfopublic Class<?> loadDelegateClass() throws ClassNotFoundException
ModuleInfoModuleInfo.getDelegateClassName().loadDelegateClass in interface ModuleInfoClassNotFoundExceptionInstantiable.loadClass()public Module createModule() throws ModuleException
ModuleInfocreateModule in interface ModuleInfoModuleExceptionpublic boolean isInteractive()
ModuleInfoRunnable.run() being called whenever any of the values change.isInteractive in interface ModuleInfopublic boolean canPreview()
ModuleInfoRunnable.run(). If this method returns false, then
calling Module.preview() will have no effect.canPreview in interface ModuleInfopublic boolean canCancel()
ModuleInfoModule.cancel() will
have no effect.canCancel in interface ModuleInfopublic boolean canRunHeadless()
ModuleInfocanRunHeadless in interface ModuleInfopublic String getInitializer()
ModuleInfogetInitializer in interface ModuleInfopublic void update(EventService eventService)
ModuleInfoupdate in interface ModuleInfopublic String getTitle()
UIDetailsgetTitle in interface ModuleInfogetTitle in interface UIDetailspublic boolean isValid()
ValidatedisValid in interface ModuleInfoisValid in interface Validatedpublic List<ValidityProblem> getProblems()
ValidatedgetProblems in interface ModuleInfogetProblems in interface ValidatedValidated.isValid() returning true.public String getIdentifier()
IdentifiablegetIdentifier in interface IdentifiablegetIdentifier in interface ModuleInfogetIdentifier in class PluginInfo<Command>Copyright © 2009–2023 SciJava. All rights reserved.