public class OrderAwarePluginRegistry<T extends Plugin<S>,S> extends SimplePluginRegistry<T,S>
PluginRegistry implementation that be made aware of a certain ordering of Plugins. By default it
orders Plugins by regarding Ordered interface or
Order annotation. To alter ordering behaviour use one of the factory
methods accepting a Comparator as parameter.| Modifier and Type | Field and Description |
|---|---|
private java.util.Comparator<? super T> |
comparator |
private static java.util.Comparator<java.lang.Object> |
DEFAULT_COMPARATOR
Comparator regarding
Ordered interface or
Order annotation. |
private static java.util.Comparator<java.lang.Object> |
DEFAULT_REVERSE_COMPARATOR
Comparator reverting the .
|
| Modifier | Constructor and Description |
|---|---|
protected |
OrderAwarePluginRegistry(java.util.List<? extends T> plugins,
java.util.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(java.util.Comparator<? super T> comparator)
|
static <S,T extends Plugin<S>> |
create(java.util.List<? extends T> plugins)
Creates a new
OrderAwarePluginRegistry with the given plugins. |
static <S,T extends Plugin<S>> |
create(java.util.List<? extends T> plugins,
java.util.Comparator<? super T> comparator)
Creates a new
OrderAwarePluginRegistry with the given plugins. |
static <S,T extends Plugin<S>> |
createReverse(java.util.List<? extends T> plugins)
Creates a new
OrderAwarePluginRegistry with the given plugins and the order of the plugins reverted. |
protected java.util.List<T> |
initialize(java.util.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, hasPluginForiteratorprivate static final java.util.Comparator<java.lang.Object> DEFAULT_COMPARATOR
Ordered interface or
Order annotation.private static final java.util.Comparator<java.lang.Object> DEFAULT_REVERSE_COMPARATOR
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(java.util.Comparator<? super T> comparator)
T - S - public static <S,T extends Plugin<S>> OrderAwarePluginRegistry<T,S> create(java.util.List<? extends T> plugins)
OrderAwarePluginRegistry with the given plugins.S - T - plugins - public static <S,T extends Plugin<S>> OrderAwarePluginRegistry<T,S> createReverse(java.util.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(java.util.List<? extends T> plugins, java.util.Comparator<? super T> comparator)
OrderAwarePluginRegistry with the given plugins.S - T - plugins - protected java.util.List<T> initialize(java.util.List<T> plugins)
PluginRegistrySupportList. 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.