org.springframework.plugin.core
Class PluginRegistrySupport<T extends Plugin<S>,S>

java.lang.Object
  extended by org.springframework.plugin.core.PluginRegistrySupport<T,S>
All Implemented Interfaces:
Iterable<T>, PluginRegistry<T,S>
Direct Known Subclasses:
SimplePluginRegistry

public abstract class PluginRegistrySupport<T extends Plugin<S>,S>
extends Object
implements PluginRegistry<T,S>, Iterable<T>

Base class for PluginRegistry implementations. Implements an initialization mechanism triggered on forst invocation of getPlugins().

Author:
Oliver Gierke

Constructor Summary
PluginRegistrySupport(List<? extends T> plugins)
          Creates a new PluginRegistrySupport instance using the given plugins.
 
Method Summary
 List<T> getPlugins()
          Returns all registered plugins.
protected  List<T> initialize(List<T> plugins)
          Callback to initialize the plugin List.
 Iterator<T> iterator()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.springframework.plugin.core.PluginRegistry
contains, countPlugins, getPluginFor, getPluginFor, getPluginFor, getPluginsFor, getPluginsFor, getPluginsFor, hasPluginFor
 

Constructor Detail

PluginRegistrySupport

public PluginRegistrySupport(List<? extends T> plugins)
Creates a new PluginRegistrySupport instance using the given plugins.

Parameters:
plugins - must not be null.
Method Detail

getPlugins

public List<T> getPlugins()
Returns all registered plugins. Only use this method if you really need to access all plugins. For distinguished access to certain plugins favour accessor methods like {link #getPluginFor} over this one. This method should only be used for testing purposes to check registry configuration.

Specified by:
getPlugins in interface PluginRegistry<T extends Plugin<S>,S>
Returns:
all plugins of the registry

initialize

protected List<T> initialize(List<T> plugins)
Callback to initialize the plugin List. Will create a defensive copy of the List to potentially unwrap a List proxy. Will filter null values from the source list as well.

Parameters:
plugins - must not be null.
Returns:

iterator

public Iterator<T> iterator()
Specified by:
iterator in interface Iterable<T extends Plugin<S>>


Copyright © 2008–2014 Pivotal, Inc.. All rights reserved.