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
,
PluginService
APPLICATION_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 |
---|---|
PT |
createInstance()
Creates an object.
|
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.
|
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() |
compareTo, getIconPath, getMenuPath, getMenuRoot, getPriority, getSelectionGroup, getTitle, isEnabled, isSelectable, isSelected, isVisible, setEnabled, setIconPath, setMenuPath, setMenuRoot, setPriority, setSelectable, setSelected, setSelectionGroup, setVisible
get, getDescription, getLabel, getName, is, set, setDescription, setLabel, setName
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
get, getDescription, getLabel, is, set, setDescription, setLabel
public 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
InstantiableException
AbstractUIDetails.getIconPath()
public boolean inject(Object o)
HasPluginInfo
interface.o
- The object to which the metadata should be assigned.public String toString()
toString
in class AbstractUIDetails
public String getClassName()
Instantiable
Class
of the objects that can
be created.getClassName
in interface Instantiable<PT extends SciJavaPlugin>
public Class<? extends PT> loadClass() throws InstantiableException
Instantiable
Instantiable.createInstance()
.
Note that this class may not be precisely T.class
but instead a
subclass thereof.
loadClass
in interface Instantiable<PT extends SciJavaPlugin>
InstantiableException
for 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
Instantiable
createInstance
in interface Instantiable<PT extends SciJavaPlugin>
InstantiableException
public String getIdentifier()
Identifiable
getIdentifier
in interface Identifiable
public String getLocation()
Locatable
getLocation
in interface Locatable
public String getVersion()
Versioned
getVersion
in interface Versioned
Copyright © 2009–2015 SciJava. All rights reserved.