public class OrderAwarePluginRegistry<T extends Plugin<S>,S> extends SimplePluginRegistry<T,S>
PluginRegistry
implementation that be made aware of a certain ordering of Plugin
s. By default it
orders Plugin
s by regarding Ordered
interface or
Order
annotation. To alter ordering behaviour use one of the factory
methods accepting a Comparator
as parameter.Modifier | Constructor and Description |
---|---|
protected |
OrderAwarePluginRegistry(List<? extends T> plugins,
Comparator<? super T> comparator)
|
Modifier and Type | Method and Description |
---|---|
static <S,T extends Plugin<S>> |
create()
Creates a new
OrderAwarePluginRegistry using the #DEFAULT_COMPARATOR . |
static <S,T extends Plugin<S>> |
create(Comparator<? super T> comparator)
|
static <S,T extends Plugin<S>> |
create(List<? extends T> plugins)
Creates a new
OrderAwarePluginRegistry with the given plugins. |
static <S,T extends Plugin<S>> |
create(List<? extends T> plugins,
Comparator<? super T> comparator)
Creates a new
OrderAwarePluginRegistry with the given plugins. |
static <S,T extends Plugin<S>> |
createReverse(List<? extends T> plugins)
Creates a new
OrderAwarePluginRegistry with the given plugins and the order of the plugins reverted. |
protected List<T> |
initialize(List<T> plugins)
Callback to initialize the plugin
List . |
OrderAwarePluginRegistry<T,S> |
reverse()
Returns a new
OrderAwarePluginRegistry with the order of the plugins reverted. |
contains, countPlugins, getPluginFor, getPluginFor, getPluginFor, getPlugins, getPluginsFor, getPluginsFor, getPluginsFor, hasPluginFor
iterator
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
protected OrderAwarePluginRegistry(List<? extends T> plugins, Comparator<? super T> comparator)
plugins
- the Plugin
s to be contained in the registry or null if the registry shall be
empty initally.comparator
- the Comparator
to be used for ordering the Plugin
s or null if the
#DEFAULT_COMPARATOR
shall be used.public static <S,T extends Plugin<S>> OrderAwarePluginRegistry<T,S> create()
OrderAwarePluginRegistry
using the #DEFAULT_COMPARATOR
.T
- S
- public static <S,T extends Plugin<S>> OrderAwarePluginRegistry<T,S> create(Comparator<? super T> comparator)
T
- S
- public static <S,T extends Plugin<S>> OrderAwarePluginRegistry<T,S> create(List<? extends T> plugins)
OrderAwarePluginRegistry
with the given plugins.S
- T
- plugins
- public static <S,T extends Plugin<S>> OrderAwarePluginRegistry<T,S> createReverse(List<? extends T> plugins)
OrderAwarePluginRegistry
with the given plugins and the order of the plugins reverted.S
- T
- plugins
- public static <S,T extends Plugin<S>> OrderAwarePluginRegistry<T,S> create(List<? extends T> plugins, Comparator<? super T> comparator)
OrderAwarePluginRegistry
with the given plugins.S
- T
- plugins
- protected List<T> initialize(List<T> plugins)
PluginRegistrySupport
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.initialize
in class PluginRegistrySupport<T extends Plugin<S>,S>
plugins
- must not be null.public OrderAwarePluginRegistry<T,S> reverse()
OrderAwarePluginRegistry
with the order of the plugins reverted.Copyright © 2008-2014–2015 Pivotal, Inc.. All rights reserved.