public class SimplePluginRegistry<T extends Plugin<S>,S> extends PluginRegistrySupport<T,S>
PluginRegistry. Simply holds all given plugins in a list dropping null
values silently on adding.| Modifier | Constructor and Description |
|---|---|
protected |
SimplePluginRegistry(List<? extends T> plugins)
Creates a new
SimplePluginRegistry. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(T plugin)
Returns whether the registry contains a given plugin.
|
int |
countPlugins()
Returns the number of registered plugins.
|
static <S,T extends Plugin<S>> |
create()
Deprecated.
use
empty() instead. |
static <S,T extends Plugin<S>> |
create(List<? extends T> plugins)
Deprecated.
use
of(List) instead. |
static <S,T extends Plugin<S>> |
empty()
Creates a new
SimplePluginRegistry. |
Optional<T> |
getPluginFor(S delimiter)
Returns the first
Plugin found for the given delimiter. |
<E extends Exception> |
getPluginFor(S delimiter,
Supplier<E> ex)
Retrieves a required plugin from the registry or throw the given exception if none can be found.
|
T |
getPluginOrDefaultFor(S delimiter,
Supplier<T> defaultSupplier)
Returns the first
Plugin supporting the given delimiter or the given lazily-provided plugin if none can be
found. |
T |
getPluginOrDefaultFor(S delimiter,
T plugin)
Returns the first
Plugin supporting the given delimiter or the given plugin if none can be found. |
List<T> |
getPlugins()
Returns all registered plugins.
|
List<T> |
getPluginsFor(S delimiter)
Returns all plugins for the given delimiter.
|
List<T> |
getPluginsFor(S delimiter,
List<? extends T> plugins)
Returns all
Plugins supporting the given delimiter or the given plugins if none found. |
<E extends Exception> |
getPluginsFor(S delimiter,
Supplier<E> ex)
Retrieves all plugins for the given delimiter or throws an exception if no plugin can be found.
|
T |
getRequiredPluginFor(S delimiter)
Returns the first
Plugin found for the given delimiter. |
T |
getRequiredPluginFor(S delimiter,
Supplier<String> message)
Returns the first
Plugin found for the given delimiter. |
boolean |
hasPluginFor(S delimiter)
Returns whether the registry contains a
Plugin matching the given delimiter. |
static <S,T extends Plugin<S>> |
of(List<? extends T> plugins)
Creates a new
SimplePluginRegistry with the given Plugin s. |
static <S,T extends Plugin<S>> |
of(T... plugins)
Creates a new
SimplePluginRegistry with the given Plugin s. |
initialize, iteratorclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitof, offorEach, spliteratorpublic static <S,T extends Plugin<S>> SimplePluginRegistry<T,S> empty()
SimplePluginRegistry.@SafeVarargs public static <S,T extends Plugin<S>> SimplePluginRegistry<T,S> of(T... plugins)
SimplePluginRegistry with the given Plugin s.plugins - must not be null.public static <S,T extends Plugin<S>> SimplePluginRegistry<T,S> of(List<? extends T> plugins)
SimplePluginRegistry with the given Plugin s.plugins - must not be null.@Deprecated public static <S,T extends Plugin<S>> SimplePluginRegistry<T,S> create()
empty() instead.SimplePluginRegistry.@Deprecated public static <S,T extends Plugin<S>> SimplePluginRegistry<T,S> create(List<? extends T> plugins)
of(List) instead.SimplePluginRegistry with the given Plugin s.public List<T> getPlugins()
PluginRegistrySupportgetPlugins in interface PluginRegistry<T extends Plugin<S>,S>getPlugins in class PluginRegistrySupport<T extends Plugin<S>,S>public Optional<T> getPluginFor(S delimiter)
PluginRegistryPlugin found for the given delimiter. Thus, further configured Plugins are
ignored.delimiter - must not be null.Optional.empty() if none found.public T getRequiredPluginFor(S delimiter)
PluginRegistryPlugin found for the given delimiter. Thus, further configured Plugins are
ignored.delimiter - must not be null.Plugin for the given originating system or Optional.empty() if none found.public T getRequiredPluginFor(S delimiter, Supplier<String> message) throws IllegalArgumentException
PluginRegistryPlugin found for the given delimiter. Thus, further configured Plugins are
ignored.delimiter - must not be null.message - a Supplier to produce an exception message in case no plugin is found.Plugin for the given originating system or Optional.empty() if none found.IllegalArgumentException - in case no Plugin for the given delimiterpublic List<T> getPluginsFor(S delimiter)
PluginRegistrydelimiter - must not be null.public <E extends Exception> T getPluginFor(S delimiter, Supplier<E> ex) throws E extends Exception
PluginRegistryE - the exception type to be thrown in case no plugin can be found.delimiter - must not be null.ex - a lazy Supplier to produce an exception in case no plugin can be found, must not be
null.E - if no plugin can be found for the given delimiterE extends Exceptionpublic <E extends Exception> List<T> getPluginsFor(S delimiter, Supplier<E> ex) throws E extends Exception
PluginRegistrypublic T getPluginOrDefaultFor(S delimiter, T plugin)
PluginRegistryPlugin supporting the given delimiter or the given plugin if none can be found.public T getPluginOrDefaultFor(S delimiter, Supplier<T> defaultSupplier)
PluginRegistryPlugin supporting the given delimiter or the given lazily-provided plugin if none can be
found.public List<T> getPluginsFor(S delimiter, List<? extends T> plugins)
PluginRegistryPlugins supporting the given delimiter or the given plugins if none found.public int countPlugins()
PluginRegistrypublic boolean contains(T plugin)
PluginRegistryplugin - must not be null.public boolean hasPluginFor(S delimiter)
PluginRegistryPlugin matching the given delimiter.delimiter - must not be null.Copyright © 2008–2019 Pivotal Software, Inc.. All rights reserved.