PT - The type of plugin described by this metadata. See
SciJavaPlugin for a list of common plugin types.public class PluginInfo<PT extends SciJavaPlugin> extends AbstractUIDetails implements Instantiable<PT>, Identifiable, Locatable, Versioned
For performance reasons, the metadata is populated without actually loading
the plugin class, by reading from an efficient binary cache (see
DefaultPluginService for details). As such, we can
very quickly build a complex structure containing all available plugins
without waiting for the Java class loader.
Plugin,
PluginServiceAPPLICATION_MENU_ROOT| Modifier | Constructor and Description |
|---|---|
|
PluginInfo(Class<? extends PT> pluginClass,
Class<PT> pluginType)
Creates a new plugin metadata object.
|
|
PluginInfo(Class<? extends PT> pluginClass,
Class<PT> pluginType,
Plugin annotation)
Creates a new plugin metadata object.
|
protected |
PluginInfo(String className,
Class<? extends PT> pluginClass,
Class<PT> pluginType,
Plugin annotation,
ClassLoader classLoader) |
|
PluginInfo(String className,
Class<PT> pluginType)
Creates a new plugin metadata object.
|
|
PluginInfo(String className,
Class<PT> pluginType,
Plugin annotation)
Creates a new plugin metadata object.
|
|
PluginInfo(String className,
Class<PT> pluginType,
Plugin annotation,
ClassLoader classLoader)
Creates a new plugin metadata object.
|
| Modifier and Type | Method and Description |
|---|---|
static PluginInfo<?> |
create(Class<? extends SciJavaPlugin> pluginClass)
Creates a
PluginInfo for the given plugin class. |
static <P extends PT,PT extends SciJavaPlugin> |
create(Class<P> pluginClass,
Class<PT> pluginType)
Creates a
PluginInfo for the given plugin class of the specified
plugin type. |
PT |
createInstance()
Creates an object.
|
static <P extends PT,PT extends SciJavaPlugin> |
get(Class<P> pluginClass,
Class<PT> pluginType,
PluginIndex pluginIndex)
Finds a
PluginInfo of the given plugin class and plugin type in the
specified PluginIndex. |
static <P extends PT,PT extends SciJavaPlugin> |
get(Class<P> pluginClass,
Collection<? extends PluginInfo<PT>> plugins)
Finds a
PluginInfo of the given plugin class in the specified list
of plugins. |
static <P extends SciJavaPlugin> |
get(Class<P> pluginClass,
PluginIndex pluginIndex)
Finds a
PluginInfo of the given plugin class in the specified
PluginIndex. |
Plugin |
getAnnotation()
Gets the associated @
Plugin annotation. |
String |
getClassName()
Gets the fully qualified name of the
Class of the objects that can
be created. |
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 |
getLocation()
Gets the URL string defining the object's location.
|
static <P extends PT,PT extends SciJavaPlugin> |
getOrCreate(Class<P> pluginClass,
Class<PT> pluginType,
PluginIndex pluginIndex)
Obtains a
PluginInfo for the given plugin class. |
static <P extends SciJavaPlugin> |
getOrCreate(Class<P> pluginClass,
PluginIndex pluginIndex)
Obtains a
PluginInfo for the given plugin class. |
Class<? extends PT> |
getPluginClass()
Obtains the
Class of the item objects, if that class has already
been loaded. |
Class<PT> |
getPluginType()
Gets the type of plugin described by the metadata.
|
String |
getVersion()
Gets the version of the object.
|
boolean |
inject(Object o)
Injects the metadata into the given object.
|
Class<? extends PT> |
loadClass()
Loads the class corresponding to the objects that are created by
Instantiable.createInstance(). |
void |
setPluginClass(Class<? extends PT> pluginClass)
Explicitly sets the
Class of the item objects. |
void |
setPluginType(Class<PT> pluginType)
Sets the type of plugin described by the metadata.
|
String |
toString() |
getIconPath, 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, waitget, getDescription, getLabel, is, set, setDescription, setLabelpublic PluginInfo(String className, Class<PT> pluginType)
className - The name of the class, which must implement
SciJavaPlugin.pluginType - The type of plugin described by this metadata.
See SciJavaPlugin for a list of common plugin types.public PluginInfo(String className, Class<PT> pluginType, Plugin annotation)
className - The name of the class, which must implement
SciJavaPlugin.pluginType - The type of plugin described by this metadata.
See SciJavaPlugin for a list of common plugin types.annotation - The @Plugin annotation to associate with this
metadata object.public PluginInfo(String className, Class<PT> pluginType, Plugin annotation, ClassLoader classLoader)
className - The name of the class, which must implement
SciJavaPlugin.pluginType - The type of plugin described by this metadata.
See SciJavaPlugin for a list of common plugin types.annotation - The @Plugin annotation to associate with this
metadata object.classLoader - The ClassLoader to use when loading the class
via loadClass(), or null to use the current thread's
context class loader by default.public PluginInfo(Class<? extends PT> pluginClass, Class<PT> pluginType)
pluginClass - The plugin class, which must implement
SciJavaPlugin.pluginType - The type of plugin described by this metadata.
See SciJavaPlugin for a list of common plugin types.public PluginInfo(Class<? extends PT> pluginClass, Class<PT> pluginType, Plugin annotation)
pluginClass - The plugin class, which must implement
SciJavaPlugin.pluginType - The type of plugin described by this metadata.
See SciJavaPlugin for a list of common plugin types.annotation - The @Plugin annotation to associate with this
metadata object.public void setPluginClass(Class<? extends PT> pluginClass)
Class of the item objects.
This is useful if your class is produced by something other than the system classloader.
public Class<? extends PT> getPluginClass()
Class of the item objects, if that class has already
been loaded.Class, or null if it has not yet been loaded by
loadClass().public void setPluginType(Class<PT> pluginType)
for a list of common plugin types.public Class<PT> getPluginType()
for a list of common plugin types.public URL getIconURL() throws InstantiableException
InstantiableExceptionAbstractUIDetails.getIconPath()public boolean inject(Object o)
HasPluginInfo interface.o - The object to which the metadata should be assigned.public String toString()
toString in class AbstractUIDetailspublic String getClassName()
InstantiableClass of the objects that can
be created.getClassName in interface Instantiable<PT extends SciJavaPlugin>public Class<? extends PT> loadClass() throws InstantiableException
InstantiableInstantiable.createInstance().
Note that this class may not be precisely T.class but instead a
subclass thereof.
loadClass in interface Instantiable<PT extends SciJavaPlugin>InstantiableExceptionfor an example of an
{@code Instantiable} type that typically instantiates objects of a
subtype of {@code T} rather than {@code T} itself.public PT createInstance() throws InstantiableException
InstantiablecreateInstance in interface Instantiable<PT extends SciJavaPlugin>InstantiableExceptionpublic String getIdentifier()
IdentifiablegetIdentifier in interface Identifiablepublic String getLocation()
LocatablegetLocation in interface Locatablepublic String getVersion()
VersionedgetVersion in interface Versionedpublic static <P extends SciJavaPlugin> PluginInfo<?> get(Class<P> pluginClass, PluginIndex pluginIndex)
PluginInfo of the given plugin class in the specified
PluginIndex. Note that to avoid loading plugin classes, class
identity is determined by class name equality only.pluginClass - The concrete class of the plugin whose
PluginInfo is desired.pluginIndex - The PluginIndex to search for a matching
PluginInfo.PluginInfo, or null if none found.public static <P extends PT,PT extends SciJavaPlugin> PluginInfo<PT> get(Class<P> pluginClass, Class<PT> pluginType, PluginIndex pluginIndex)
PluginInfo of the given plugin class and plugin type in the
specified PluginIndex. Note that to avoid loading plugin
classes, class identity is determined by class name equality only.pluginClass - The concrete class of the plugin whose
PluginInfo is desired.pluginType - The type of the plugin; see getPluginType().pluginIndex - The PluginIndex to search for a matching
PluginInfo.PluginInfo, or null if none found.public static <P extends PT,PT extends SciJavaPlugin> PluginInfo<PT> get(Class<P> pluginClass, Collection<? extends PluginInfo<PT>> plugins)
PluginInfo of the given plugin class in the specified list
of plugins. Note that to avoid loading plugin classes, class identity
is determined by class name equality only.pluginClass - The concrete class of the plugin whose
PluginInfo is desired.plugins - The list of plugins to search for a match.PluginInfo, or null if none found.public static PluginInfo<?> create(Class<? extends SciJavaPlugin> pluginClass)
PluginInfo for the given plugin class. The class must be
a concrete class annotated with the @Plugin annotation, from which
the plugin type will be inferred.pluginClass - The concrete class of the plugin for which a new
PluginInfo is desired.PluginInfo for the given plugin class.IllegalArgumentException - if the given class is not annotated
with @Plugin, or its annotated type() is not a supertype of the plugin class.public static <P extends PT,PT extends SciJavaPlugin> PluginInfo<PT> create(Class<P> pluginClass, Class<PT> pluginType)
PluginInfo for the given plugin class of the specified
plugin type.pluginClass - The concrete class of the plugin for which a new
PluginInfo is desired.pluginType - The type of the plugin; see getPluginType().PluginInfo for the given plugin class.public static <P extends SciJavaPlugin> PluginInfo<?> getOrCreate(Class<P> pluginClass, PluginIndex pluginIndex)
PluginInfo for the given plugin class. If one already
exists in the specified PluginIndex, it is retrieved (see
get(Class, PluginIndex)); otherwise, a new one is created (see
create(Class)) but not added to the index.pluginClass - The concrete class of the plugin whose
PluginInfo is desired.pluginIndex - The PluginIndex to search for a matching
PluginInfo.IllegalArgumentException - when creating a new PluginInfo if
the associated plugin type cannot be inferred; see
create(Class).public static <P extends PT,PT extends SciJavaPlugin> PluginInfo<PT> getOrCreate(Class<P> pluginClass, Class<PT> pluginType, PluginIndex pluginIndex)
PluginInfo for the given plugin class. If one already
exists in the specified PluginIndex, it is retrieved (see
get(Class, PluginIndex)); otherwise, a new one is created (see
create(Class)) but not added to the index.pluginClass - The concrete class of the plugin whose
PluginInfo is desired.pluginType - The type of the plugin; see getPluginType().pluginIndex - The PluginIndex to search for a matching
PluginInfo.Copyright © 2015–2022 SciJava. All rights reserved.