Interface ModuleDescriptor<T>
- All Superinterfaces:
Resourced,ScopeAware
-
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()Override this if your plugin needs to clean up when it's been removed.booleanCompares the specified object with this module descriptor for equality.The complete key for this module, including the plugin key.A simple description of this descriptor.Key used to overridegetDescription()when using internationalisation.default StringReturns the display name of this descriptor, e.g.Key used to overridegetName()when using internationalisation.getKey()The key for this module, unique within the plugin.The particular module object created by this plugin.The class of the module this descriptor creates.getName()A simple string name for this descriptor.The plugin key for this module, derived from the complete key.inthashCode()Returns the hash code value for this module descriptor.voidInitialise a module given its parent plugin and the XML element representing the module.default booleanisBroken()Returns true if this Module is "broken".booleanGet whether this plugin module is enabled.booleanWhether or not this plugin module is enabled by default.booleanWhether or not this plugin module is a "system" module that shouldn't be made visible/disable-able to the user.booleanIf a min java version has been specified this will return true if the running jvm is >= to the specified version.default voidChanges state to "broken"Methods inherited from interface com.atlassian.plugin.Resourced
getResourceDescriptor, getResourceDescriptors, getResourceLocationMethods inherited from interface com.atlassian.plugin.ScopeAware
getScopeKey
-
Method Details
-
getCompleteKey
String getCompleteKey()The complete key for this module, including the plugin key.Format is plugin.key:module.key
- Returns:
- The complete key for this module.
- See Also:
-
getPluginKey
String getPluginKey()The plugin key for this module, derived from the complete key.- Returns:
- The plugin key for this module.
- See Also:
-
getKey
String getKey()The key for this module, unique within the plugin.- Returns:
- The key for this module.
- See Also:
-
getName
String getName()A simple string name for this descriptor.- Returns:
- The name for this ModuleDescriptor.
-
getDescription
String getDescription()A simple description of this descriptor.- Returns:
- The description for this ModuleDescriptor.
-
getModuleClass
The class of the module this descriptor creates.- Returns:
- The class of the module this descriptor creates.
- See Also:
-
getModule
T getModule()The particular module object created by this plugin.- Returns:
- The module object created by this plugin.
- See Also:
-
init
Initialise a module given its parent plugin and the XML element representing the module.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.- Parameters:
plugin- The plugin that the module belongs to. Must not be null.element- Element representing the module. Must not be null.- Throws:
PluginParseException- Can be thrown if an error occurs while parsing the XML element.
-
isEnabledByDefault
boolean isEnabledByDefault()Whether or not this plugin module is enabled by default.- Returns:
trueif this plugin module is enabled by default.
-
isSystemModule
boolean isSystemModule()Whether or not this plugin module is a "system" module that shouldn't be made visible/disable-able to the user. System plugin modules also don't have their permissions checked, as they may be created dynamically in response to another, more safe module- Returns:
trueif this plugin module is a "system" plugin that shouldn't be made visible/disable-able to the user.
-
destroy
void destroy()Override this if your plugin needs to clean up when it's been removed. -
getMinJavaVersion
Float getMinJavaVersion() -
satisfiesMinJavaVersion
boolean satisfiesMinJavaVersion()If a min java version has been specified this will return true if the running jvm is >= to the specified version. If this is not set then it is treated as not having a preference.- Returns:
- true if satisfied, false otherwise.
-
getParams
-
getI18nNameKey
String getI18nNameKey()Key used to overridegetName()when using internationalisation.- Returns:
- the i18n key. May be null.
-
getDescriptionKey
String getDescriptionKey()Key used to overridegetDescription()when using internationalisation.- Returns:
- the i18n key. May be null.
-
getPlugin
Plugin getPlugin()- Returns:
- The plugin this module descriptor is associated with
-
equals
Compares the specified object with this module descriptor for equality.Returns
trueif the given object is also a module descriptor and the two descriptors have the same "complete key" as determined bygetCompleteKey().This ensures that the
equalsmethod works properly across different implementations of theModuleDescriptorinterface. -
hashCode
int hashCode()Returns the hash code value for this module descriptor. The hash code of a module descriptordis defined to be:getCompleteKey() == null ? 0 : getCompleteKey().hashCode()This ensures thatd1.equals(d2)implies thatd1.hashCode()==d2.hashCode()for any two Module Descriptorsd1andd2, as required by the general contract ofObject.hashCode. -
isEnabled
boolean isEnabled()Get whether this plugin module is enabled.- Returns:
- If this module is enabled
- Since:
- 3.1
-
setBroken
default void setBroken()Changes state to "broken"Being breakable is something subclasses can opt in to, therefore by default
ModuleDescriptors are unbreakable, this is a no-op, andisBroken()returnsfalse -
isBroken
default boolean isBroken()Returns true if this Module is "broken".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.
- Returns:
trueif broken,falseotherwise
-
getDisplayName
Returns the display name of this descriptor, e.g. for use in log messages. Does not identify the owning plugin.- Returns:
- a non-blank name
- Since:
- 4.6.3
-