com.atlassian.confluence.plugin
Class ModuleDescriptorCache<T extends com.atlassian.plugin.ModuleDescriptor<?>>

java.lang.Object
  extended by com.atlassian.confluence.plugin.ModuleDescriptorCache<T>

public class ModuleDescriptorCache<T extends com.atlassian.plugin.ModuleDescriptor<?>>
extends java.lang.Object

Caches module descriptors of a given module descriptor class and its subclasses. This is useful in cases where you would otherwise frequently call PluginAccessor.getEnabledModuleDescriptorsByClass(Class).

Since:
3.0

Nested Class Summary
static interface ModuleDescriptorCache.Initializer<T>
          Implementations of this interface are used to initialize a ModuleDescriptorCache
 
Constructor Summary
ModuleDescriptorCache(java.lang.Class<? extends T> moduleDescriptorClass)
           
ModuleDescriptorCache(java.lang.Class<? extends T> moduleDescriptorClass, com.atlassian.plugin.predicate.ModuleDescriptorPredicate moduleDescriptorPredicate)
           
 
Method Summary
 java.util.Collection<T> getDescriptors()
          Returns the module descriptors currently in the cache.
 void initialize(ModuleDescriptorCache.Initializer<T> initializer)
          Initialize the cache with the module descriptors returned by the initializer.
 void pluginModuleDisabled(com.atlassian.plugin.event.events.PluginModuleDisabledEvent event)
          Removes module descriptors from the cache when plugin modules are disabled.
 void pluginModuleEnabled(com.atlassian.plugin.event.events.PluginModuleEnabledEvent event)
          Adds module descriptors to the cache when plugin modules are enabled.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ModuleDescriptorCache

public ModuleDescriptorCache(java.lang.Class<? extends T> moduleDescriptorClass)

ModuleDescriptorCache

public ModuleDescriptorCache(java.lang.Class<? extends T> moduleDescriptorClass,
                             com.atlassian.plugin.predicate.ModuleDescriptorPredicate moduleDescriptorPredicate)
Method Detail

pluginModuleEnabled

public void pluginModuleEnabled(com.atlassian.plugin.event.events.PluginModuleEnabledEvent event)
Adds module descriptors to the cache when plugin modules are enabled.


pluginModuleDisabled

public void pluginModuleDisabled(com.atlassian.plugin.event.events.PluginModuleDisabledEvent event)
Removes module descriptors from the cache when plugin modules are disabled.


getDescriptors

public java.util.Collection<T> getDescriptors()
Returns the module descriptors currently in the cache.


initialize

public void initialize(ModuleDescriptorCache.Initializer<T> initializer)
Initialize the cache with the module descriptors returned by the initializer.



Copyright © 2003-2014 Atlassian. All Rights Reserved.