public interface ModuleDescriptor<T> extends ScopeAware, Resourced
| Modifier and Type | Method and Description |
|---|---|
void |
destroy()
Override this if your plugin needs to clean up when it's been removed.
|
boolean |
equals(Object obj)
Compares the specified object with this module descriptor for equality.
|
String |
getCompleteKey()
The complete key for this module, including the plugin key.
|
String |
getDescription()
A simple description of this descriptor.
|
String |
getDescriptionKey()
Key used to override
getDescription() when using
internationalisation. |
default String |
getDisplayName()
Returns the display name of this descriptor, e.g.
|
String |
getI18nNameKey()
Key used to override
getName() when using internationalisation. |
String |
getKey()
The key for this module, unique within the plugin.
|
Float |
getMinJavaVersion() |
T |
getModule()
The particular module object created by this plugin.
|
Class<T> |
getModuleClass()
The class of the module this descriptor creates.
|
String |
getName()
A simple string name for this descriptor.
|
Map<String,String> |
getParams() |
Plugin |
getPlugin() |
String |
getPluginKey()
The plugin key for this module, derived from the complete key.
|
int |
hashCode()
Returns the hash code value for this module descriptor.
|
void |
init(Plugin plugin,
org.dom4j.Element element)
Initialise a module given it's parent plugin and the XML element
representing the module.
|
default boolean |
isBroken()
Returns true if this Module is "broken".
|
boolean |
isEnabled()
Get whether this plugin module is enabled.
|
boolean |
isEnabledByDefault()
Whether or not this plugin module is enabled by default.
|
boolean |
isSystemModule()
Whether or not this plugin module is a "system" module that shouldn't be
made visible/disable-able to the user.
|
boolean |
satisfiesMinJavaVersion()
If a min java version has been specified this will return true if the
running jvm is >= to the specified version.
|
default void |
setBroken()
Changes state to "broken"
|
getScopeKeygetResourceDescriptor, getResourceDescriptors, getResourceLocationString getCompleteKey()
Format is plugin.key:module.key
getKey(),
getPluginKey()String getPluginKey()
getKey(),
getCompleteKey()String getKey()
getCompleteKey(),
getPluginKey()String getName()
String getDescription()
Class<T> getModuleClass()
getModule()T getModule()
getModuleClass()void init(@Nonnull Plugin plugin, @Nonnull org.dom4j.Element element) throws PluginParseException
Since atlassian-plugins v2.2, you can no longer load classes from the
plugin in this method, because the OSGi bundle that they will live in is
not built yet. Load classes in the StateAware.enabled()
method instead.
plugin - The plugin that the module belongs to. Must not be null.element - XML element representing the module. Must not be null.PluginParseException - Can be thrown if an error occurs while
parsing the XML element.boolean isEnabledByDefault()
true if this plugin module is enabled by default.boolean isSystemModule()
true if this plugin module is a "system" plugin that
shouldn't be made visible/disable-able to the user.void destroy()
Float getMinJavaVersion()
boolean satisfiesMinJavaVersion()
String getI18nNameKey()
getName() when using internationalisation.String getDescriptionKey()
getDescription() when using
internationalisation.Plugin getPlugin()
boolean equals(Object obj)
Returns true if the given object is also a module descriptor and the two descriptors have the same
"complete key" as determined by getCompleteKey().
This ensures that the equals method works properly across different implementations of the ModuleDescriptor interface.
int hashCode()
getCompleteKey() == null ? 0 : getCompleteKey().hashCode()
This ensures that d1.equals(d2) implies that
d1.hashCode()==d2.hashCode() for any two Module Descriptors
d1 and d2, as required by the general
contract of Object.hashCode.hashCode in class ObjectObject.hashCode(),
Object.equals(Object),
equals(Object)boolean isEnabled()
default void setBroken()
Being breakable is something subclasses can opt in to, therefore by default ModuleDescriptors
are unbreakable, this is a no-op, and isBroken() returns false
default boolean isBroken()
A "broken" module means that even though this ModuleDescriptor is enabled, calling getModule() results
in an error. This typically occurs when the plugin version is not compatible with the version of the host product.
Note that some modules are lazy-loaded, and so this method is optimistic: it will return false until we discover that the Module is not loadable.
true if broken, false otherwisedefault String getDisplayName()
Copyright © 2019 Atlassian. All rights reserved.